PHP Class Rees\Sanitizer\Sanitizer

Datei anzeigen Open project: daylerees/sanitizer Class Usage Examples

Protected Properties

Property Type Description
$container Illuminate\Container\Container Container instance used to resolve classes.
$sanitizers array Array of registered sanitizers.

Public Methods

Method Description
__construct ( mixed $container = null ) Allow a container instance to be set via constructor.
executeSanitizer ( mixed $sanitizer, $parameters ) : mixed Execute a sanitizer using the appropriate method.
register ( string $name, mixed $callback ) : void Register a new sanitization method.
sanitize ( array $rules, array &$data ) : array Sanitize a dataset using rules.

Protected Methods

Method Description
getSanitizer ( string $key ) : Callable Retrieve a sanitizer by key.
resolveCallback ( string $callback ) : array Resolve a callback from a class and method pair.
runGlobalSanitizers ( array &$rules, array &$data ) : void Apply global sanitizer rules.
sanitizeField ( array &$data, string $field, mixed $ruleset ) Execute sanitization over a specific field.

Method Details

__construct() public method

Allow a container instance to be set via constructor.
public __construct ( mixed $container = null )
$container mixed

executeSanitizer() public method

Execute a sanitizer using the appropriate method.
public executeSanitizer ( mixed $sanitizer, $parameters ) : mixed
$sanitizer mixed
return mixed

getSanitizer() protected method

Retrieve a sanitizer by key.
protected getSanitizer ( string $key ) : Callable
$key string
return Callable

register() public method

Register a new sanitization method.
public register ( string $name, mixed $callback ) : void
$name string
$callback mixed
return void

resolveCallback() protected method

Resolve a callback from a class and method pair.
protected resolveCallback ( string $callback ) : array
$callback string
return array

runGlobalSanitizers() protected method

Apply global sanitizer rules.
protected runGlobalSanitizers ( array &$rules, array &$data ) : void
$rules array
$data array
return void

sanitize() public method

Sanitize a dataset using rules.
public sanitize ( array $rules, array &$data ) : array
$rules array
$data array
return array

sanitizeField() protected method

Execute sanitization over a specific field.
protected sanitizeField ( array &$data, string $field, mixed $ruleset )
$data array
$field string
$ruleset mixed

Property Details

$container protected_oe property

Container instance used to resolve classes.
protected Container,Illuminate\Container $container
return Illuminate\Container\Container

$sanitizers protected_oe property

Array of registered sanitizers.
protected array $sanitizers
return array