public function addService($service, $serviceName = 0) 
	{
		if ( is_object( $service ) ) 
		{
			$reflection = new ReflectionObject( $service );
		} 
		else if ( is_string( $service ) && class_exists( $service ) ) 
		{
			$reflection = new ReflectionClass( $service );
		} 
		else if ( is_callable( $service ) ) // method passed directly
		{ 
			$this->addMethod( $serviceName, $service );
			return;
		} 
		else 
		{
			throw new Ripcord_InvalidArgumentException( 'Unknown service type ' . $serviceName, 
				ripcord::unknownServiceType );
		}
		if ( $serviceName && !is_numeric( $serviceName ) ) 
		{
			$serviceName .= '.';
		} 
		else 
		{
			$serviceName = '';
		}
		$methods = $reflection->getMethods();
		if ( is_array( $methods ) ) 
		{
			foreach( $methods as $method ) 
			{
				if ( substr( $method->name, 0, 1 ) != '_'
					&& !$method->isPrivate() && !$method->isProtected()) 
				{
					$rpcMethodName = $serviceName . $method->name;
					$this->addMethod( 
						$rpcMethodName, 
						array( $service, $method->name )
					);
				}
			}
		}
	}
public function addService($service, $serviceName = 0) 
	{
		if ( is_object( $service ) ) 
		{
			$reflection = new ReflectionObject( $service );
		} 
		else if ( is_string( $service ) && class_exists( $service ) ) 
		{
			$reflection = new ReflectionClass( $service );
		} 
		else if ( is_callable( $service ) ) // method passed directly
		{ 
			$this->addMethod( $serviceName, $service );
			return;
		} 
		else 
		{
			throw new Ripcord_InvalidArgumentException( 'Unknown service type ' . $serviceName, 
				ripcord::unknownServiceType );
		}
		if ( $serviceName && !is_numeric( $serviceName ) ) 
		{
			$serviceName .= '.';
		} 
		else 
		{
			$serviceName = '';
		}
		$methods = $reflection->getMethods();
		if ( is_array( $methods ) ) 
		{
			foreach( $methods as $method ) 
			{
				if ( substr( $method->name, 0, 1 ) != '_'
					&& !$method->isPrivate() && !$method->isProtected()) 
				{
					$rpcMethodName = $serviceName . $method->name;
					$this->addMethod( 
						$rpcMethodName, 
						array( $service, $method->name )
					);
				}
			}
		}
	}
public function addService ( $ service , $ serviceName = 0 ) { if ( is_object ( $ service ) ) { $ reflection = new ReflectionObject ( $ service ) ; } else if ( is_string ( $ service ) && class_exists ( $ service ) ) { $ reflection = new ReflectionClass ( $ service ) ; } else if ( is_callable ( $ service ) ) // method passed directly { $ this -> addMethod ( $ serviceName , $ service ) ; return ; } else { throw new Ripcord_InvalidArgumentException ( 'Unknown service type ' . $ serviceName , ripcord :: unknownServiceType ) ; } if ( $ serviceName && ! is_numeric ( $ serviceName ) ) { $ serviceName .= '.' ; } else { $ serviceName = '' ; } $ methods = $ reflection -> getMethods ( ) ; if ( is_array ( $ methods ) ) { foreach ( $ methods as $ method ) { if ( substr ( $ method -> name , 0 , 1 ) != '_' && ! $ method -> isPrivate ( ) && ! $ method -> isProtected ( ) ) { $ rpcMethodName = $ serviceName . $ method -> name ; $ this -> addMethod ( $ rpcMethodName , array ( $ service , $ method -> name ) ) ; } } } }
Allows you to add a service to the server after construction.
@param object $service The object or class whose public methods must be added to the rpc server. May also be a function or method.
@param string $serviceName Optional. The namespace for the methods.
@throws Ripcord_InvalidArgumentException (ripcord::unknownServiceType) when passed an incorrect service
Allows you to add a service to the server after construction .