PHP 클래스 Kahlan\Filter\Filter

파일 보기 프로젝트 열기: crysalead/kahlan 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_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.

공개 메소드들

메소드 설명
_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.

보호된 메소드들

메소드 설명
_methodFilters ( string | object $context ) : object Gets the MethodFilters instance of a context.

메소드 상세

_classFilters() 공개 정적인 메소드

Gets the whole filters associated to a class/instance's method.
public static _classFilters ( mixed $context, string $method ) : array
$context mixed The class/instance context.
$method string The name of the method to get the filters from.
리턴 array The whole filters data or filters associated to a class/instance's method.

_methodFilters() 보호된 정적인 메소드

Gets the MethodFilters instance of a context.
protected static _methodFilters ( string | object $context ) : object
$context string | object The class/instance context.
리턴 object

apply() 공개 정적인 메소드

Applies a filter to a method.
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.
리턴 string The name reference of the applied filter.

detach() 공개 정적인 메소드

Detaches a filter completely, by class/instance or on a method basis.
public static detach ( mixed $context, string $method, $name = null )
$context mixed The instance or class name context to apply a new filter.
$method string The name of the method to apply the filter.

enable() 공개 정적인 메소드

Enables/disables the filter system.
public static enable ( boolean $active = true )
$active boolean

filters() 공개 정적인 메소드

Or sets the whole filters data.
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.
리턴 array The whole filters data or filters associated to a class/instance's method.

on() 공개 정적인 메소드

Cuts the normal execution of a method to run all applied filter for the 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.
리턴 mixed Returns The result of the chain.

register() 공개 정적인 메소드

Registers an aspect in the system.
public static register ( string | array | Closur\Closure $name, $aspect = null ) : string | null
$name string | array | Closur\Closure The aspect name identifier, the aspects array or the aspect closure.
리턴 string | null The registered aspect name identifier or `null` for multiple registration.

registered() 공개 정적인 메소드

Checks if as aspect exists or returns all registered aspects if $name is null.
public static registered ( string | null $name = null ) : boolean
$name string | null The aspect name identifier or `null` to get all registered aspects.
리턴 boolean

reset() 공개 정적인 메소드

Removes filters for all classes.
public static reset ( )

unregister() 공개 정적인 메소드

Unregisters an aspect in the system.
public static unregister ( string $name )
$name string The aspect name identifier to unregister.

프로퍼티 상세

$_aspects 보호되어 있는 정적으로 프로퍼티

An array of Closure indexed by a name identifier.
protected static array $_aspects
리턴 array

$_cachedFilters 보호되어 있는 정적으로 프로퍼티

A cached array of filters indexed by class name & method name.
protected static array $_cachedFilters
리턴 array

$_enabled 보호되어 있는 정적으로 프로퍼티

Indicates if the filter system is enabled or not.
protected static bool $_enabled
리턴 boolean

$_methodFilters 보호되어 있는 정적으로 프로퍼티

An array of MethodFilters indexed by class name.
protected static array $_methodFilters
리턴 array