Class Amfphp_Core_Common_ServiceRouter

Description

The Service Router class is responsible for executing the remote service method and returning it's value.

based on the old 'Executive' of php 1.9. It looks for a service either explicitely defined in a ClassFindInfo object, or in a service folder.

  • author: Ariel Sommeria-klein

Located in /Amfphp/Core/Common/ServiceRouter.php (line 21)


	
			
Class Constant Summary
 FILTER_SERVICE_OBJECT = 'FILTER_SERVICE_OBJECT'
Variable Summary
Method Summary
Amfphp_Core_Common_ServiceRouter __construct (array $serviceFolderPaths, array $serviceNames2ClassFindInfo, [Boolean $checkArgumentCount = false])
mixed executeServiceCall (string $serviceName, string $methodName,  $parameters)
serviceName getServiceObject (String $serviceName)
Variables
Boolean $checkArgumentCount (line 46)

check parameters. This is useful for development, but should be disabled for production

  • access: public
array $serviceFolderPaths (line 34)

paths to folders containing services(relative or absolute)

  • var: of paths
  • access: public
array $serviceNames2ClassFindInfo (line 40)
  • var: of ClassFindInfo
  • access: public
Methods
Constructor __construct (line 54)
  • access: public
Amfphp_Core_Common_ServiceRouter __construct (array $serviceFolderPaths, array $serviceNames2ClassFindInfo, [Boolean $checkArgumentCount = false])
  • array $serviceFolderPaths: folders containing service classes
  • array $serviceNames2ClassFindInfo: a dictionary of service classes represented in a ClassFindInfo.
  • Boolean $checkArgumentCount
executeServiceCall (line 106)

loads and instanciates a service class matching $serviceName, then calls the function defined by $methodName using $parameters as parameters throws an exception if service not found.

if the service exists but not the function, an exception is thrown by call_user_func_array. It is pretty explicit, so no further code was added

  • return: the result of the function call
  • access: public
mixed executeServiceCall (string $serviceName, string $methodName,  $parameters)
  • string $serviceName
  • string $methodName
  • array $parameters
getServiceObject (line 67)

get a service object by its name. Looks for a match in serviceNames2ClassFindInfo, then in the defined service folders.

If none found, an exception is thrown

  • todo: maybe option for a fully qualified class name.
  • access: public
serviceName getServiceObject (String $serviceName)
  • String $serviceName
Class Constants
FILTER_SERVICE_OBJECT = 'FILTER_SERVICE_OBJECT' (line 29)

filter called when the service object is created. Useful for authentication

Documentation generated on Mon, 23 Jan 2012 17:22:07 -0300 by phpDocumentor 1.4.3