PHP Класс Amfphp_Core_Common_ServiceRouter, amfphp-2.0

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.
Автор: Ariel Sommeria-klein
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$checkArgumentCount boolean check parameters. This is useful for development, but should be disabled for production
$serviceFolders paths to folders containing services(relative or absolute)
$serviceNames2ClassFindInfo of ClassFindInfo

Открытые методы

Метод Описание
__construct ( array $serviceFolders, array $serviceNames2ClassFindInfo, boolean $checkArgumentCount = false ) constructor
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.
getServiceObject ( String $serviceName ) : Object get service object
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.

Описание методов

__construct() публичный Метод

constructor
public __construct ( array $serviceFolders, array $serviceNames2ClassFindInfo, boolean $checkArgumentCount = false )
$serviceFolders array folders containing service classes
$serviceNames2ClassFindInfo array a dictionary of service classes represented in a ClassFindInfo.
$checkArgumentCount boolean

executeServiceCall() публичный Метод

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
public executeServiceCall ( string $serviceName, string $methodName, array $parameters ) : mixed
$serviceName string
$methodName string
$parameters array
Результат mixed the result of the function call

getServiceObject() публичный Метод

get service object
public getServiceObject ( String $serviceName ) : Object
$serviceName String
Результат Object service object

getServiceObjectStatically() публичный статический Метод

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
public static getServiceObjectStatically ( type $serviceName, array $serviceFolders, array $serviceNames2ClassFindInfo ) : Object
$serviceName type
$serviceFolders array
$serviceNames2ClassFindInfo array
Результат Object service object

Описание свойств

$checkArgumentCount публичное свойство

check parameters. This is useful for development, but should be disabled for production
public bool $checkArgumentCount
Результат boolean

$serviceFolders публичное свойство

paths to folders containing services(relative or absolute)
public $serviceFolders

$serviceNames2ClassFindInfo публичное свойство

of ClassFindInfo
public $serviceNames2ClassFindInfo