Property | Type | Description | |
---|---|---|---|
$_aspects | array | An array of Closure indexed by a name identifier. | |
$_cachedFilters | array | A cached array of filters indexed by class name & method name. | |
$_enabled | boolean | Indicates if the filter system is enabled or not. | |
$_methodFilters | array | An array of MethodFilters indexed by class name. |
Method | Description | |
---|---|---|
_classFilters ( mixed $context, string $method ) : array | Gets the whole filters associated to a class/instance's method. | |
apply ( mixed $context, string | array $methods, string $name ) : string | Applies a filter to a method. | |
detach ( mixed $context, string $method, $name = null ) | Detaches a filter completely, by class/instance or on a method basis. | |
enable ( boolean $active = true ) | Enables/disables the filter system. | |
filters ( mixed $context = null, string | null $method = null ) : array | Gets the whole filters data or filters associated to a class/instance's method. | |
on ( mixed $context, string $method, array $params, Closure $callback, array $filters = [] ) : mixed | Cuts the normal execution of a method to run all applied filter for the method. | |
register ( string | array | Closur\Closure $name, $aspect = null ) : string | null | Registers an aspect in the system. | |
registered ( string | null $name = null ) : boolean | Checks if as aspect exists or returns all registered aspects if $name is null. | |
reset ( ) | Removes filters for all classes. | |
unregister ( string $name ) | Unregisters an aspect in the system. |
Method | Description | |
---|---|---|
_methodFilters ( string | object $context ) : object | Gets the MethodFilters instance of a context. |
public static apply ( mixed $context, string | array $methods, string $name ) : string | ||
$context | mixed | The instance or class name context to apply a new filter. |
$methods | string | array | The name or array of method names to be filtered. |
$name | string | The filter name to apply. |
return | string | The name reference of the applied filter. |
public static filters ( mixed $context = null, string | null $method = null ) : array | ||
$context | mixed | If `null` returns the whole filters data. If `$context` is an array use `$context` as the whole filters data. Otherwise `$context` stands for the class/instance context. |
$method | string | null | The name of the method to get the filters from or `null` to get all of them. |
return | array | The whole filters data or filters associated to a class/instance's method. |
public static on ( mixed $context, string $method, array $params, Closure $callback, array $filters = [] ) : mixed | ||
$context | mixed | The instance or class name context to perform the filtering on. |
$method | string | The name of the method which is going the be filtered. |
$params | array | The parameters passed to the original method. |
$callback | Closure | The original method logic closure. |
$filters | array | Additional filters to apply to the method for this call only. |
return | mixed | Returns The result of the chain. |
public static unregister ( string $name ) | ||
$name | string | The aspect name identifier to unregister. |
protected static array $_aspects | ||
return | array |
protected static array $_cachedFilters | ||
return | array |
protected static bool $_enabled | ||
return | boolean |
protected static array $_methodFilters | ||
return | array |