Class Filters

Summary

Fully Qualified Name: CodeIgniter\Filters\Filters

Description

Filters

Methods

Name Description Defined By
__construct() Constructor. Filters
addFilter() Adds a new alias to the config file. Filters
enableFilter() Ensures that a specific filter is on and enabled for the current request. Filters
getArguments() Returns the arguments for a specified key, or all. Filters
getFilters() Returns the processed filters array. Filters
initialize() 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. Filters
run() Runs through all of the filters for the specified uri and position. Filters
setResponse() Set the response explicity. Filters

Method Details

__construct()

Constructor.

Parameter Name Type Description
$config \type
$request \RequestInterface
$response \ResponseInterface

Returns:

addFilter()

Adds a new alias to the config file.

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

Parameter Name Type Description
$class string
$alias string|null
$when string
$section string

Returns: $this

enableFilter()

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.

Parameter Name Type Description
$name string
$when string

Returns: \CodeIgniter\Filters\Filters

getArguments()

Returns the arguments for a specified key, or all.

Parameter Name Type Description
$key

Returns: mixed

getFilters()

Returns the processed filters array.

Returns: array

initialize()

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.

Parameter Name Type Description
$uri string

Returns: \Filters

run()

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

Parameter Name Type Description
$uri string
$position string

Returns: \CodeIgniter\HTTP\RequestInterface|\CodeIgniter\HTTP\ResponseInterface|mixed

setResponse()

Set the response explicity.

Parameter Name Type Description
$response \ResponseInterface

Returns:

Top