Elgg  Version 3.0
Public Member Functions | List of all members
Elgg\HandlersService Class Reference

Helpers for providing callable-based APIs. More...

Public Member Functions

 call ($callable, $object, $args)
 Call the handler with the hook/event object. More...
 
 isCallable ($callback)
 Test is callback is callable Unlike is_callable(), this function also tests invokable classes. More...
 
 getReflector ($callable)
 Get the reflection interface for a callable. More...
 
 getParamTypeForCallable ($callable, $index=0)
 Get the type for a parameter of a callable. More...
 
 getType (\ReflectionParameter $param)
 Get the type of a parameter. More...
 
 describeCallable ($callable, $file_root= '')
 Get a string description of a callback. More...
 
 fingerprintCallable ($callable)
 Get a string that uniquely identifies a callback across requests (for caching) More...
 

Detailed Description

Helpers for providing callable-based APIs.

getType() uses code from Zend::detectType. https://github.com/zendframework/zend-code/blob/master/src/Reflection/ParameterReflection.php

Definition at line 20 of file HandlersService.php.

Member Function Documentation

Elgg\HandlersService::call (   $callable,
  $object,
  $args 
)

Call the handler with the hook/event object.

Parameters
callable$callableCallable
mixed$objectEvent object
array$argsArguments for legacy events/hooks
Returns
array [success, result, object]

Definition at line 31 of file HandlersService.php.

Elgg\HandlersService::describeCallable (   $callable,
  $file_root = '' 
)

Get a string description of a callback.

E.g. "function_name", "Static::method", "(ClassName)->method", "(Closure path/to/file.php:23)"

Parameters
mixed$callableCallable
string$file_rootIf provided, it will be removed from the beginning of file names
Returns
string

Definition at line 219 of file HandlersService.php.

Elgg\HandlersService::fingerprintCallable (   $callable)

Get a string that uniquely identifies a callback across requests (for caching)

Parameters
callable$callableCallable
Returns
string Empty if cannot uniquely identify this callable

Definition at line 253 of file HandlersService.php.

Elgg\HandlersService::getParamTypeForCallable (   $callable,
  $index = 0 
)

Get the type for a parameter of a callable.

Parameters
callable$callableCallable
int$indexIndex of argument
Returns
null|string Empty string = no type, null = no parameter

Definition at line 164 of file HandlersService.php.

Elgg\HandlersService::getReflector (   $callable)

Get the reflection interface for a callable.

Parameters
callable$callableCallable
Returns

Definition at line 94 of file HandlersService.php.

Elgg\HandlersService::getType ( \ReflectionParameter  $param)

Get the type of a parameter.

Parameters
\ReflectionParameter$paramParameter
Returns
string

Definition at line 180 of file HandlersService.php.

Elgg\HandlersService::isCallable (   $callback)

Test is callback is callable Unlike is_callable(), this function also tests invokable classes.

See also
is_callable()
Parameters
mixed$callbackCallable
Returns
bool

Definition at line 82 of file HandlersService.php.


The documentation for this class was generated from the following file: