0byt3m1n1
Path:
/
home
/
mgatv524
/
atvcms.com.br
/
maisqtv
/
vendor
/
respect
/
validation
/
library
/
Rules
/
[
Home
]
File: AllOf.php
<?php /* * This file is part of Respect/Validation. * * (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net> * * For the full copyright and license information, please view the "LICENSE.md" * file that was distributed with this source code. */ namespace Respect\Validation\Rules; class AllOf extends AbstractComposite { public function assert($input) { $exceptions = $this->validateRules($input); $numRules = count($this->rules); $numExceptions = count($exceptions); $summary = [ 'total' => $numRules, 'failed' => $numExceptions, 'passed' => $numRules - $numExceptions, ]; if (!empty($exceptions)) { throw $this->reportError($input, $summary)->setRelated($exceptions); } return true; } public function check($input) { foreach ($this->getRules() as $rule) { $rule->check($input); } return true; } public function validate($input) { foreach ($this->getRules() as $rule) { if (!$rule->validate($input)) { return false; } } return true; } }