Properties

$filters

$filters : array

The processed filters that will be used to check against.

Type

array

$initialized

$initialized : boolean

Whether we've done initial processing on the filter lists.

Type

boolean

$arguments

$arguments : array

Any arguments to be passed to filters.

Type

array

Methods

run()

run(string  $uri, string  $position = 'before') : \CodeIgniter\HTTP\RequestInterface|\CodeIgniter\HTTP\ResponseInterface|mixed

Runs through all of the filters for the specified uri and position.

Parameters

string $uri
string $position

Throws

\CodeIgniter\Filters\Exceptions\FilterException

Returns

\CodeIgniter\HTTP\RequestInterface|\CodeIgniter\HTTP\ResponseInterface|mixed

initialize()

initialize(string  $uri = null) : \CodeIgniter\Filters\Filters

Runs through our list of filters provided by the configuration object to get them ready for use, including getting uri masks to proper regex, removing those we can from the possibilities based on HTTP method, etc.

The resulting $this->filters is an array of only filters that should be applied to this request.

We go ahead an process the entire tree because we'll need to run through both a before and after and don't want to double process the rows.

Parameters

string $uri

Returns

\CodeIgniter\Filters\Filters

getFilters()

getFilters() : array

Returns the processed filters array.

Returns

array

addFilter()

addFilter(string  $class, string|null  $alias = null, string  $when = 'before', string  $section = 'globals') : $this

Adds a new alias to the config file.

MUST be called prior to initialize(); Intended for use within routes files.

Parameters

string $class
string|null $alias
string $when
string $section

Returns

$this

enableFilter()

enableFilter(string  $name, string  $when = 'before') : \CodeIgniter\Filters\Filters

Ensures that a specific filter is on and enabled for the current request.

Filters can have "arguments". This is done by placing a colon immediately after the filter name, followed by a comma-separated list of arguments that are passed to the filter when executed.

Parameters

string $name
string $when

Returns

\CodeIgniter\Filters\Filters

getArguments()

getArguments(\CodeIgniter\Filters\string  $key = null) : mixed

Returns the arguments for a specified key, or all.

Parameters

\CodeIgniter\Filters\string $key

Returns

mixed

processGlobals()

processGlobals(string  $uri = null) : \CodeIgniter\Filters\type

Add any applicable (not excluded) global filter settings to the mix.

Parameters

string $uri

Returns

\CodeIgniter\Filters\type

processMethods()

processMethods() : \CodeIgniter\Filters\type

Add any method-specific flters to the mix.

Returns

\CodeIgniter\Filters\type

processFilters()

processFilters(string  $uri = null) : \CodeIgniter\Filters\type

Add any applicable configured filters to the mix.

Parameters

string $uri

Returns

\CodeIgniter\Filters\type

pathApplies()

pathApplies(string  $uri, mixed  $paths) : boolean

Check paths for match for URI

Parameters

string $uri

URI to test against

mixed $paths

The path patterns to test

Returns

boolean —

True if any of the paths apply to the URI