示例#1
0
 protected function assertPropertySimpleConstraints($data, PropertySimpleAbstract $property, $path)
 {
     if ($property->getPattern() !== null) {
         $result = preg_match('/^(' . $property->getPattern() . '){1}$/', $data);
         if (!$result) {
             throw new ValidationException($path . ' does not match pattern [' . $property->getPattern() . ']');
         }
     }
     if ($property->getEnumeration() !== null) {
         if (!in_array($data, $property->getEnumeration())) {
             throw new ValidationException($path . ' is not in enumeration [' . implode(', ', $property->getEnumeration()) . ']');
         }
     }
 }