PHP 클래스 Sirius\Validation\Validator

상속: implements Sirius\Validation\ValidatorInterface
파일 보기 프로젝트 열기: siriusphp/validation 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$dataWrapper Sirius\Validation\DataWrapper\WrapperInterface The object that will contain the data
$errorMessagePrototype Sirius\Validation\ErrorMessage
$messages array
$ruleFactory RuleFactory
$rules array
$wasValidated boolean

공개 메소드들

메소드 설명
__construct ( RuleFactory $ruleFactory = null, Sirius\Validation\ErrorMessage $errorMessagePrototype = null )
add ( string $selector, string | callback $name = null, string | array $options = null, string $messageTemplate = null, string $label = null ) : Validator
addMessage ( string $item, string $message = null ) : self
addMultiple ( array $selectorRulesCollection ) : Validator
clearMessages ( string $item = null ) : self Clears the messages of an item
getDataWrapper ( mixed $data = null ) : Sirius\Validation\DataWrapper\WrapperInterface The data wrapper will be used to wrap around the data passed to the validator This way you can validate anything, not just arrays (which is the default)
getErroMessagePrototype ( ) : Sirius\Validation\ErrorMessage Retrieve the error message prototype
getMessages ( string $item = null ) : array
getRuleFactory ( ) : RuleFactory Retrieve the rule factory
getRules ( )
remove ( string $selector, mixed $name = true, mixed $options = null ) : self
setData ( $data )
setErrorMessagePrototype ( Sirius\Validation\ErrorMessage $errorMessagePrototype ) : Sirius\Validation\Rule\AbstractValidator
validate ( mixed $data = null ) : boolean Performs the validation

보호된 메소드들

메소드 설명
ensureSelectorRulesExist ( string $selector, string $label = null )

메소드 상세

__construct() 공개 메소드

public __construct ( RuleFactory $ruleFactory = null, Sirius\Validation\ErrorMessage $errorMessagePrototype = null )
$ruleFactory RuleFactory
$errorMessagePrototype Sirius\Validation\ErrorMessage

add() 공개 메소드

public add ( string $selector, string | callback $name = null, string | array $options = null, string $messageTemplate = null, string $label = null ) : Validator
$selector string
$name string | callback
$options string | array
$messageTemplate string
$label string
리턴 Validator

addMessage() 공개 메소드

public addMessage ( string $item, string $message = null ) : self
$item string data identifier (eg: 'email', 'addresses[0][state]')
$message string
리턴 self

addMultiple() 공개 메소드

public addMultiple ( array $selectorRulesCollection ) : Validator
$selectorRulesCollection array
리턴 Validator

clearMessages() 공개 메소드

Clears the messages of an item
public clearMessages ( string $item = null ) : self
$item string
리턴 self

ensureSelectorRulesExist() 보호된 메소드

protected ensureSelectorRulesExist ( string $selector, string $label = null )
$selector string
$label string

getDataWrapper() 공개 메소드

The data wrapper will be used to wrap around the data passed to the validator This way you can validate anything, not just arrays (which is the default)
public getDataWrapper ( mixed $data = null ) : Sirius\Validation\DataWrapper\WrapperInterface
$data mixed
리턴 Sirius\Validation\DataWrapper\WrapperInterface

getErroMessagePrototype() 공개 메소드

Retrieve the error message prototype
public getErroMessagePrototype ( ) : Sirius\Validation\ErrorMessage
리턴 Sirius\Validation\ErrorMessage

getMessages() 공개 메소드

public getMessages ( string $item = null ) : array
$item string key of the messages array (eg: 'password', 'addresses[0][line_1]')
리턴 array

getRuleFactory() 공개 메소드

Retrieve the rule factory
public getRuleFactory ( ) : RuleFactory
리턴 RuleFactory

getRules() 공개 메소드

public getRules ( )

remove() 공개 메소드

public remove ( string $selector, mixed $name = true, mixed $options = null ) : self
$selector string data selector
$name mixed rule name or true if all rules should be deleted for that selector
$options mixed rule options, necessary for rules that depend on params for their ID
리턴 self

setData() 공개 메소드

public setData ( $data )

setErrorMessagePrototype() 공개 메소드

public setErrorMessagePrototype ( Sirius\Validation\ErrorMessage $errorMessagePrototype ) : Sirius\Validation\Rule\AbstractValidator
$errorMessagePrototype Sirius\Validation\ErrorMessage
리턴 Sirius\Validation\Rule\AbstractValidator

validate() 공개 메소드

Performs the validation
public validate ( mixed $data = null ) : boolean
$data mixed array to be validated
리턴 boolean

프로퍼티 상세

$dataWrapper 보호되어 있는 프로퍼티

The object that will contain the data
protected WrapperInterface,Sirius\Validation\DataWrapper $dataWrapper
리턴 Sirius\Validation\DataWrapper\WrapperInterface

$errorMessagePrototype 보호되어 있는 프로퍼티

protected ErrorMessage,Sirius\Validation $errorMessagePrototype
리턴 Sirius\Validation\ErrorMessage

$messages 보호되어 있는 프로퍼티

protected array $messages
리턴 array

$ruleFactory 보호되어 있는 프로퍼티

protected RuleFactory,Sirius\Validation $ruleFactory
리턴 RuleFactory

$rules 보호되어 있는 프로퍼티

protected array $rules
리턴 array

$wasValidated 보호되어 있는 프로퍼티

protected bool $wasValidated
리턴 boolean