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.

package Amfphp_Core_Common
author Ariel Sommeria-klein

 Methods

constructor

__construct(array $serviceFolderPaths, array $serviceNames2ClassFindInfo, Boolean $checkArgumentCount) 

Parameters

$serviceFolderPaths

array

folders containing service classes

$serviceNames2ClassFindInfo

array

a dictionary of service classes represented in a ClassFindInfo.

$checkArgumentCount

Boolean

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.

executeServiceCall(string $serviceName, string $methodName, array $parameters) : mixed

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

Parameters

$serviceName

string

$methodName

string

$parameters

array

Returns

mixedthe result of the function call

get service object

getServiceObject(String $serviceName) : Object

Parameters

$serviceName

String

Returns

Objectservice object

get a service object by its name.

getServiceObjectStatically(\type $serviceName, array $serviceFolderPaths, array $serviceNames2ClassFindInfo) : Object
Static

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. this method is static so that it can be used also by the discovery service '__' are replaced by '/' to help the client generator support packages without messing with folders and the like

Parameters

$serviceName

\type

$serviceFolderPaths

array

$serviceNames2ClassFindInfo

array

Returns

Objectservice object

 Properties

 

$checkArgumentCount : Boolean

This is useful for development, but should be disabled for production

 

$serviceFolderPaths : array
 

of ClassFindInfo

$serviceNames2ClassFindInfo : array

 Constants

 

filter called when the service object is created.

FILTER_SERVICE_OBJECT 

Useful for authentication

param
param
param
param