Свойство | Тип | Описание | |
---|---|---|---|
$_autoConfig | array | Holds an array of values that should be processed on initialization. Each value should have a matching protected property (prefixed with _) defined in the class. If the property is an array, the property name should be the key and the value should be 'merge'. See the _init() method for more details. | |
$_config | array | **Do not override.** Pass any additional variables to parent::__construct(). | |
$_methodFilters | array | Contains a 2-dimensional array of filters applied to this object's methods, indexed by method name. See the associated methods for more details. | |
$_parents | array | Parents of the current class. |
Метод | Описание | |
---|---|---|
__construct ( array $config = [] ) : void | Constructor. Initializes class configuration ($_config), and assigns object properties using the _init() method, unless otherwise specified by configuration. See below for details. | |
__set_state ( array $data ) : object | PHP magic method used in conjunction with var_export() to allow objects to be re-instantiated with their pre-existing properties and values intact. This method can be called statically on any class that extends Object to return an instance of it. | |
applyFilter ( mixed $method, Closure $filter = null ) : void | Apply a closure to a method of the current object instance. | |
invokeMethod ( string $method, array $params = [] ) : mixed | Calls a method on this object with the given parameters. Provides an OO wrapper for call_user_func_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. |
Метод | Описание | |
---|---|---|
_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. This, along with the Filters class, is the core of Lithium's filters system. This system allows you to "reach into" an object's methods which are marked as _filterable_, and intercept calls to those methods, optionally modifying parameters or return values. | |
_init ( ) : void | Initializer function called by the constructor unless the constructor 'init' flag is set to false. May be used for testing purposes, where objects need to be manipulated in an un-initialized state, or for high-overhead operations that require more control than the constructor provides. Additionally, this method iterates over the $_autoConfig property to automatically assign configuration settings to their corresponding properties. | |
_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. |
public __construct ( array $config = [] ) : void | ||
$config | array | The configuration options which will be assigned to the `$_config` property. This method accepts one configuration option: - `'init'` _boolean_: Controls constructor behavior for calling the `_init()` method. If `false`, the method is not called, otherwise it is. Defaults to `true`. |
Результат | void |
public static __set_state ( array $data ) : object | ||
$data | array | An array of properties and values with which to re-instantiate the object. These properties can be both public and protected. |
Результат | object | Returns an instance of the requested object with the given properties set. |
protected _filter ( string $method, array $params, Closure $callback, array $filters = [] ) : mixed | ||
$method | string | The name of the method being executed, usually the value of `__METHOD__`. |
$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. |
Результат | mixed | Returns the return value of `$callback`, modified by any filters passed in `$filters` or applied with `applyFilter()`. |
public 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. |
Результат | void |
public 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`. |
Результат | boolean | Returns `true` if the method can be called, `false` otherwise. |
protected array $_autoConfig | ||
Результат | array |
protected array $_config | ||
Результат | array |
protected array $_methodFilters | ||
Результат | array |
protected static array $_parents | ||
Результат | array |