Exemple #1
0
 /**
  * {@inheritdoc}
  */
 public function normalize(stdClass $schema, Context $context, Walker $walker)
 {
     $context->enterNode('pattern');
     if (!is_string($schema->pattern)) {
         throw new InvalidTypeException($context, Types::TYPE_STRING);
     }
     if (!Utils::isValidRegex($schema->pattern)) {
         throw new InvalidRegexException($context);
     }
     $context->leaveNode();
 }
Exemple #2
0
 private function parsePatternPropertiesProperty(stdClass $schema, Context $context, Walker $walker)
 {
     if (!is_object($schema->patternProperties)) {
         throw new InvalidTypeException($context, Types::TYPE_OBJECT);
     }
     foreach ($schema->patternProperties as $regex => $value) {
         $context->enterNode($regex);
         if (!Utils::isValidRegex($regex)) {
             throw new InvalidRegexException($context);
         }
         if (!is_object($value)) {
             throw new InvalidTypeException($context, Types::TYPE_OBJECT);
         }
         $walker->parseSchema($value, $context);
         $context->leaveNode();
     }
 }