PHP Class lithium\core\StaticObject

See also: lithium\core\Object
Afficher le fichier Open project: unionofrad/lithium Class Usage Examples

Protected Properties

Свойство Type Description
$_methodFilters Stores the closures that represent the method filters. They are indexed by called class.
$_parents array Keeps a cached list of each class' inheritance tree.

Méthodes publiques

Méthode Description
applyFilter ( mixed $method, Closure $filter = null ) : void Apply a closure to a method of the current static object.
invokeMethod ( string $method, array $params = [] ) : mixed Calls a method on this object with the given parameters. Provides an OO wrapper for forward_static_call_array(), and improves performance by using straight method calls in most cases.
respondsTo ( string $method, boolean $internal = false ) : boolean Determines if a given method can be called.

Méthodes protégées

Méthode Description
_filter ( string $method, array $params, Closure $callback, array $filters = [] ) : mixed Executes a set of filters against a method by taking a method's main implementation as a callback, and iteratively wrapping the filters around it.
_instance ( string | object $name, array $options = [] ) : object Returns an instance of a class with given config. The name could be a key from the classes array, a fully namespaced class name, or an object. Typically this method is used in _init to create the dependencies used in the current class.
_parents ( ) : array Gets and caches an array of the parent methods of a class.
_stop ( integer | string $status ) : void Exit immediately. Primarily used for overrides during testing.

Method Details

_filter() protected static méthode

Executes a set of filters against a method by taking a method's main implementation as a callback, and iteratively wrapping the filters around it.
See also: lithium\util\collection\Filters
protected static _filter ( string $method, array $params, Closure $callback, array $filters = [] ) : mixed
$method string The name of the method being executed.
$params array An associative array containing all the parameters passed into the method.
$callback Closure The method's implementation, wrapped in a closure.
$filters array Additional filters to apply to the method for this call only.
Résultat mixed

_instance() protected static méthode

Returns an instance of a class with given config. The name could be a key from the classes array, a fully namespaced class name, or an object. Typically this method is used in _init to create the dependencies used in the current class.
protected static _instance ( string | object $name, array $options = [] ) : object
$name string | object A `classes` key or fully-namespaced class name.
$options array The configuration passed to the constructor.
Résultat object

_parents() protected static méthode

Gets and caches an array of the parent methods of a class.
protected static _parents ( ) : array
Résultat array Returns an array of parent classes for the current class.

_stop() protected static méthode

Exit immediately. Primarily used for overrides during testing.
protected static _stop ( integer | string $status ) : void
$status integer | string integer range 0 to 254, string printed on exit
Résultat void

applyFilter() public static méthode

Apply a closure to a method of the current static object.
See also: lithium\core\StaticObject::_filter()
See also: lithium\util\collection\Filters
public static applyFilter ( mixed $method, Closure $filter = null ) : void
$method mixed The name of the method to apply the closure to. Can either be a single method name as a string, or an array of method names. Can also be false to remove all filters on the current object.
$filter Closure The closure that is used to filter the method(s), can also be false to remove all the current filters for the given method.
Résultat void

invokeMethod() public static méthode

Calls a method on this object with the given parameters. Provides an OO wrapper for forward_static_call_array(), and improves performance by using straight method calls in most cases.
public static invokeMethod ( string $method, array $params = [] ) : mixed
$method string Name of the method to call.
$params array Parameter list to use when calling `$method`.
Résultat mixed Returns the result of the method call.

respondsTo() public static méthode

Determines if a given method can be called.
public static respondsTo ( string $method, boolean $internal = false ) : boolean
$method string Name of the method.
$internal boolean Provide `true` to perform check from inside the class/object. When `false` checks also for public visibility; defaults to `false`.
Résultat boolean Returns `true` if the method can be called, `false` otherwise.

Property Details

$_methodFilters protected_oe static_oe property

Stores the closures that represent the method filters. They are indexed by called class.
protected static $_methodFilters

$_parents protected_oe static_oe property

Keeps a cached list of each class' inheritance tree.
protected static array $_parents
Résultat array