PHP 클래스 Piwik\API\Proxy

Proxy receives all the API calls requests via call() and forwards them to the right object, with the parameters in the right order. It will also log the performance of API calls (time spent, parameter values, etc.) if logger available
상속: extends Piwik\Singleton
파일 보기 프로젝트 열기: piwik/piwik 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$alreadyRegistered array of already registered plugins names

공개 메소드들

메소드 설명
__construct ( )
buildApiActionName ( $pluginName, $apiAction )
call ( string $className, string $methodName, array $parametersRequest ) : mixed | null Will execute $className->$methodName($parametersValues) If any error is detected (wrong number of parameters, method not found, class not found, etc.) it will throw an exception
getCountRegisteredClasses ( ) : integer Returns number of classes already loaded
getMetadata ( ) : array Returns array containing reflection meta data for all the loaded classes eg. number of parameters, method names, etc.
getModuleNameFromClassName ( string $className ) : string Returns the 'moduleName' part of '\\Piwik\\Plugins\\moduleName\\API'
getParametersList ( string $class, string $name ) : array Returns the parameters names and default values for the method $name of the class $class
isDeprecatedMethod ( $class, $methodName ) Check if given method name is deprecated or not.
isExistingApiAction ( $pluginName, $apiAction )
registerClass ( string $className ) Registers the API information of a given module.
setHideIgnoredFunctions ( boolean $hideIgnoredFunctions ) Sets whether to hide '@ignore'd functions from method metadata or not.
shouldHideAPIMethod ( $docComment ) : boolean

보호된 메소드들

메소드 설명
checkIfMethodIsAvailable ( ReflectionMethod $method ) : boolean

비공개 메소드들

메소드 설명
checkClassIsSingleton ( string $className ) Checks that the class is a Singleton (presence of the getInstance() method)
checkMethodExists ( string $className, string $methodName ) Checks that the method exists in the class
getRequestParametersArray ( array $requiredParameters, array $parametersRequest ) : array Returns an array containing the values of the parameters to pass to the method to call
includeApiFile ( string $fileName ) Includes the class API by looking up plugins/xxx/API.php
isMethodAvailable ( string $className, string $methodName ) : boolean Returns true if the method is found in the API of the given class name.
loadMethodMetadata ( string $class, ReflectionMethod $method )
setDocumentation ( ReflectionClass $rClass, string $className ) Will be displayed in the API page

메소드 상세

__construct() 공개 메소드

public __construct ( )

buildApiActionName() 공개 메소드

public buildApiActionName ( $pluginName, $apiAction )

call() 공개 메소드

It also logs the API calls, with the parameters values, the returned value, the performance, etc. You can enable logging in config/global.ini.php (log_api_call)
public call ( string $className, string $methodName, array $parametersRequest ) : mixed | null
$className string The class name (eg. API)
$methodName string The method name
$parametersRequest array The parameters pairs (name=>value)
리턴 mixed | null

checkIfMethodIsAvailable() 보호된 메소드

protected checkIfMethodIsAvailable ( ReflectionMethod $method ) : boolean
$method ReflectionMethod
리턴 boolean

getCountRegisteredClasses() 공개 메소드

Returns number of classes already loaded

getMetadata() 공개 메소드

Returns array containing reflection meta data for all the loaded classes eg. number of parameters, method names, etc.
public getMetadata ( ) : array
리턴 array

getModuleNameFromClassName() 공개 메소드

Returns the 'moduleName' part of '\\Piwik\\Plugins\\moduleName\\API'
public getModuleNameFromClassName ( string $className ) : string
$className string "API"
리턴 string "Referrers"

getParametersList() 공개 메소드

Returns the parameters names and default values for the method $name of the class $class
public getParametersList ( string $class, string $name ) : array
$class string The class name
$name string The method name
리턴 array Format array( 'testParameter' => null, // no default value 'life' => 42, // default value = 42 'date' => 'yesterday', );

isDeprecatedMethod() 공개 메소드

Check if given method name is deprecated or not.
public isDeprecatedMethod ( $class, $methodName )

isExistingApiAction() 공개 메소드

public isExistingApiAction ( $pluginName, $apiAction )

registerClass() 공개 메소드

The module to be registered must be - a singleton (providing a getInstance() method) - the API file must be located in plugins/ModuleName/API.php for example plugins/Referrers/API.php The method will introspect the methods, their parameters, etc.
public registerClass ( string $className )
$className string ModuleName eg. "API"

setHideIgnoredFunctions() 공개 메소드

Sets whether to hide '@ignore'd functions from method metadata or not.
public setHideIgnoredFunctions ( boolean $hideIgnoredFunctions )
$hideIgnoredFunctions boolean

shouldHideAPIMethod() 공개 메소드

public shouldHideAPIMethod ( $docComment ) : boolean
$docComment
리턴 boolean

프로퍼티 상세

$alreadyRegistered 보호되어 있는 프로퍼티

array of already registered plugins names
protected $alreadyRegistered