Class Phalcon\Filter\FilterLocator

extends Phalcon\Service\Locator

Source on GitHub

Creates a Phalcon\Filter\FilterLocator class. You can add any sanitizers you want in it.

Constants


const FILTER_ABSINT      = 'absint';
const FILTER_ALNUM       = 'alnum';
const FILTER_ALPHA       = 'alpha';
const FILTER_BOOL        = 'bool';
const FILTER_EMAIL       = 'email';
const FILTER_FLOAT       = 'float';
const FILTER_INT         = 'int';
const FILTER_LOWER       = 'lower';
const FILTER_LOWERFIRST  = 'lowerFirst';
const FILTER_REGEX       = 'regex';
const FILTER_REMOVE      = 'remove';
const FILTER_REPLACE     = 'replace';
const FILTER_SPECIAL     = 'special';
const FILTER_SPECIALFULL = 'specialFull';
const FILTER_STRING      = 'string';
const FILTER_STRIPTAGS   = 'striptags';
const FILTER_TRIM        = 'trim';
const FILTER_UPPER       = 'upper';
const FILTER_UPPERFIRST  = 'upperFirst';
const FILTER_UPPERWORDS  = 'upperWords';
const FILTER_URL         = 'url';

Properties

Protected

protected $services = array();
protected $mapper   = array();

Methods

public function sanitize( mixed $value, string|array $sanitizers, bool $noRecursive = false ): mixed

Sanitizes a value with a specified single or set of sanitizers

public function __construct( array $mapper = array() )

Key value pairs with name as the key and a callable as the value for the service object

public function __call( string $name, array $parameters ): mixed 

Services being called via magic methods

public function get( string $name ): object

Get a service. If it is not in the mapper array, create a new object, set it and then return it.

public function has( string $name ): bool

Checks if a service exists in the map array

public function set( string $name, Callable $service ): void

Set a new service to the mapper array