CallbackHandler

A handler for a event, event, filterchain, etc. Abstracts PHP callbacks, primarily to allow for lazy-loading and ensuring availability of default arguments (currying).

category Zend
package Zend_Stdlib
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License

 Methods

Constructor

__construct(string|array|object $callback, array $metadata = array()) : void

Parameters

$callback

stringarrayobject

PHP callback

$metadata

Invoke as functor

__invoke() : mixed

Returns

mixed

Invoke handler

call(array $args = array()) : mixed

Parameters

$args

array

Arguments to pass to callback

Returns

mixed

Error handler

errorHandler(integer $errno, string $errstr) : void

Used by registerCallback() when calling is_callable() to capture engine warnings.

Parameters

$errno

integer

$errstr

string

Retrieve registered callback

getCallback() : Callable

Returns

Callable

Retrieve a single metadatum

getMetadatum(string $name) : mixed

Parameters

$name

string

Returns

mixed

Registers the callback provided in the constructor

registerCallback(Callable $callback) : void

If you have pecl/weakref http://pecl.php.net/weakref installed, this method provides additional behavior.

If a callback is a functor, or an array callback composing an object instance, this method will pass the object to a WeakRef instance prior to registering the callback.

Parameters

$callback

Callable

Validate a static method call

validateStringCallbackFor54(string $callback) : true

Validates that a static method call in PHP 5.4 will actually work

Parameters

$callback

string

Exceptions

\Zend_Stdlib_Exception_InvalidCallbackException if invalid

Returns

true

 Properties

 

PHP callback to invoke

$callback : string | array

Default

 

Did an error occur when testing the validity of the callback?

$error : boolean

Default

false