new validator
This commit is contained in:
parent
bfaaf77b3e
commit
e9231ead67
2 changed files with 25 additions and 3 deletions
|
|
@ -27,7 +27,8 @@ class Validator
|
|||
'filename' => 'ctiso\\Validator\\Rule\\FileName',
|
||||
'count' => 'ctiso\\Validator\\Rule\\Count',
|
||||
'isfile' => 'ctiso\\Validator\\Rule\\IsFile',
|
||||
'code' => 'ctiso\\Validator\\Rule\\Code'
|
||||
'code' => 'ctiso\\Validator\\Rule\\Code',
|
||||
'reg' => 'ctiso\\Validator\\Rule\\PregMatch',
|
||||
);
|
||||
|
||||
function __construct($rules = array()) {
|
||||
|
|
@ -77,7 +78,7 @@ class Validator
|
|||
}
|
||||
}
|
||||
|
||||
public function addRule($rule/*: any*/) {
|
||||
public function addRule($rule/*:z any*/) {
|
||||
if (is_array($rule)) {
|
||||
$this->chain = array_merge($this->chain, $rule);
|
||||
} else {
|
||||
|
|
@ -85,7 +86,7 @@ class Validator
|
|||
}
|
||||
}
|
||||
|
||||
public function skip($rule/*: AbstractRule*/, $container/*: Collection*/) // -> Rule_Abstract
|
||||
public function skip($rule/*z: AbstractRule*/, $container/*: Collection*/) // -> Rule_Abstract
|
||||
{
|
||||
if ($rule->skipEmpty()) {
|
||||
$data = $container->get($rule->field);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue