示例#1
0
 /**
  * @param AllOf $rule
  *
  * @return ValidationInterface
  */
 private function filterAllOf(AllOf $rule)
 {
     $rules = $rule->getRules();
     if (count($rules) != 1) {
         throw new ComponentException('AllOf rule must have only one Key rule');
     }
     return current($rules);
 }
示例#2
0
 private function absorbAllOf(AllOf $rule, $input)
 {
     $rules = $rule->getRules();
     while ($current = array_shift($rules)) {
         $rule = $current;
         if (!$rule instanceof AllOf) {
             continue;
         }
         if (!$rule->validate($input)) {
             continue;
         }
         $rules = $rule->getRules();
     }
     return $rule;
 }