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
파일 보기 프로젝트 열기: silexlabs/amfphp-2.0 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$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