PHP Class Jyxo\Input\Factory

Author: Jakub Tománek
Datei anzeigen Open project: jyxo/php Class Usage Examples

Public Methods

Method Description
addFilterPrefix ( string $prefix ) Registers a new filter prefix.
addValidatorPrefix ( string $prefix ) Registers a new validator prefix.
getFilterByName ( string | Jyxo\Input\FilterInterface $name, mixed | array $param = null ) : Jyxo\Input\FilterInterface Returns a particular filter by its name.
getValidatorByName ( string | Jyxo\Input\ValidatorInterface $name, mixed | array $param = null ) : Jyxo\Input\ValidatorInterface Returns a particular validator by its name.

Private Methods

Method Description
findClass ( string $name, array $prefixes ) : string | null Finds a class by its name and possible prefixes.
getClass ( string $className, array $params ) : object Creates a class instance with an arbitrary number of parameters.

Method Details

addFilterPrefix() public static method

The backslash at the end is required; e.g. for class "\Api\ToInt" the prefix would be "\Api\" a filter name "ToInt".
public static addFilterPrefix ( string $prefix )
$prefix string

addValidatorPrefix() public static method

The backslash at the end is required; e.g. for class "\Api\IsInt" the prefix would be "\Api\" and validator name "IsInt".
public static addValidatorPrefix ( string $prefix )
$prefix string Validator class prefix

getFilterByName() public method

Returns a particular filter by its name.
public getFilterByName ( string | Jyxo\Input\FilterInterface $name, mixed | array $param = null ) : Jyxo\Input\FilterInterface
$name string | Jyxo\Input\FilterInterface Filter name
$param mixed | array Filter constructor parameters. In case of a single parameter it can be its value, an array of values otherwise. NULL in case of no parameter.
return Jyxo\Input\FilterInterface

getValidatorByName() public method

Returns a particular validator by its name.
public getValidatorByName ( string | Jyxo\Input\ValidatorInterface $name, mixed | array $param = null ) : Jyxo\Input\ValidatorInterface
$name string | Jyxo\Input\ValidatorInterface Validator name
$param mixed | array Validator constructor parameters. In case of a single parameter it can be its value, an array of values otherwise. NULL in case of no parameter.
return Jyxo\Input\ValidatorInterface