Beispiel #1
0
 public static function isValidPack($value, $pack)
 {
     // If rules is string, then this is aliases
     if (!is_array($pack)) {
         $pack = Parser::parse($pack);
     }
     foreach ($pack ?: [] as $rule => $ruleArg) {
         if (is_numeric($rule)) {
             $rule = $ruleArg;
             $ruleArg = null;
         }
         if (!self::isValidAtom($value, $rule, $ruleArg)) {
             return false;
         }
     }
     return true;
 }
Beispiel #2
0
 public function test_parse2()
 {
     $this->setExpectedException('\\vacuum\\exception\\ParsingException');
     Parser::parse('[[]');
 }