PHP 클래스 Jyxo\Input\Fluent

Allows chaining multiple validators and checking multiple values in one validation cycle.
저자: Jakub Tománek
파일 보기 프로젝트 열기: jyxo/php

공개 메소드들

메소드 설명
__construct ( ) Constructor.
__get ( string $offset ) : mixed Magic getter for easier retrieving of values.
all ( ) : self Validates all variables.
check ( mixed $var, string $name ) : self Starts a new value checking.
close ( ) : self Closes a chain.
condition ( string $name, mixed $param = null ) : self Adds a conditional chain.
defaultValue ( mixed $value ) : self Sets a default value in case the validation fails.
file ( string $index ) : self Checks file upload.
filter ( string $name, mixed $param = null ) : self Adds a filter to the chain.s
getErrors ( ) : array Returns errors.
getValue ( string $name ) : mixed Returns a value by name.
getValues ( ) : array Returns all values.
isValid ( boolean $assocErrors = false ) : boolean Performs validation and filtering of all variables.
post ( string $name, mixed $default = null ) : self Checks a POST variable.
query ( string $name, mixed $default = null ) : self Checks a GET variable.
request ( string $name, mixed $default = null ) : self Checks a POST/GET variable
validate ( string $name, string $errorMessage = null, mixed $param = null ) : self Adds a validator to the chain.
validateAll ( ) Calls isValid(), but throws an exception on error.
walk ( boolean $addFilter = true ) : self Adds a subchain to the current chain that treats the value a an array.

비공개 메소드들

메소드 설명
addToCheck ( array $global, string $name, mixed $default = null ) Adds a variable to the chain.
checkChain ( Chain $chain, mixed &$value, mixed $default, string $name = null ) : boolean Checks a chain.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( )

__get() 공개 메소드

Magic getter for easier retrieving of values.
public __get ( string $offset ) : mixed
$offset string Value name
리턴 mixed

all() 공개 메소드

Validates all variables.
public all ( ) : self
리턴 self

check() 공개 메소드

Starts a new value checking.
public check ( mixed $var, string $name ) : self
$var mixed Value to check.
$name string Variable name
리턴 self

close() 공개 메소드

Closes a chain.
public close ( ) : self
리턴 self

condition() 공개 메소드

If there are conditions in the current chain, adds the condition as a subchain.
public condition ( string $name, mixed $param = null ) : self
$name string Validator name
$param mixed Additional validator parameter
리턴 self

defaultValue() 공개 메소드

Sets a default value in case the validation fails.
public defaultValue ( mixed $value ) : self
$value mixed Default value
리턴 self

file() 공개 메소드

Requires \Jyxo\Input\Upload.
또한 보기: Jyxo\Input\Upload
public file ( string $index ) : self
$index string File index
리턴 self

filter() 공개 메소드

Adds a filter to the chain.s
public filter ( string $name, mixed $param = null ) : self
$name string Filter name
$param mixed Additional filter parameter
리턴 self

getErrors() 공개 메소드

Returns errors.
public getErrors ( ) : array
리턴 array

getValue() 공개 메소드

Returns a value by name.
public getValue ( string $name ) : mixed
$name string Variable name
리턴 mixed

getValues() 공개 메소드

Returns all values.
public getValues ( ) : array
리턴 array

isValid() 공개 메소드

Performs validation and filtering of all variables.
public isValid ( boolean $assocErrors = false ) : boolean
$assocErrors boolean Return error messages in an associative array
리턴 boolean

post() 공개 메소드

Checks a POST variable.
public post ( string $name, mixed $default = null ) : self
$name string Variable name
$default mixed Default value
리턴 self

query() 공개 메소드

Checks a GET variable.
public query ( string $name, mixed $default = null ) : self
$name string Variable name
$default mixed Default value
리턴 self

request() 공개 메소드

Checks a POST/GET variable
public request ( string $name, mixed $default = null ) : self
$name string Variable name
$default mixed Default value
리턴 self

validate() 공개 메소드

Adds a validator to the chain.
public validate ( string $name, string $errorMessage = null, mixed $param = null ) : self
$name string Validator name
$errorMessage string Validator error message
$param mixed Additional validator parameter
리턴 self

validateAll() 공개 메소드

The exception contains only the first validation error message.
public validateAll ( )

walk() 공개 메소드

Automatically adds the isArray validator.
public walk ( boolean $addFilter = true ) : self
$addFilter boolean Add the Trim filter (removes empty elements)
리턴 self