FILTER_SERVICE_OBJECT
FILTER_SERVICE_OBJECT
filter called when the service object is created. Useful for authentication
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.
__construct(array $serviceFolders, array $serviceNames2ClassFindInfo, Boolean $checkArgumentCount)
constructor
array | $serviceFolders | folders containing service classes |
array | $serviceNames2ClassFindInfo | a dictionary of service classes represented in a ClassFindInfo. |
Boolean | $checkArgumentCount |
getServiceObjectStatically(\type $serviceName, array $serviceFolders, array $serviceNames2ClassFindInfo) : Object
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 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 the service object can either be in the global namespace or in the namespace suggested by the name. For example a call to Sub1/Sub2/NamespaceTestService will load the PHP file in Sub1/Sub2/NamespaceTestService, and return an instance of either NamespaceTestService or Sub1\Sub2\NamespaceTestService
\type | $serviceName | |
array | $serviceFolders | |
array | $serviceNames2ClassFindInfo |
service object
executeServiceCall(string $serviceName, string $methodName, array $parameters) : mixed
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
string | $serviceName | |
string | $methodName | |
array | $parameters |
the result of the function call