Beispiel #1
0
 protected function parseScalar(PropertySimpleAbstract $property, array $data)
 {
     if (isset($data['pattern'])) {
         $property->setPattern($data['pattern']);
     }
     if (isset($data['enum'])) {
         $property->setEnumeration($data['enum']);
     }
     if (isset($data['minimum'])) {
         $property->setMin($data['minimum']);
     }
     if (isset($data['maximum'])) {
         $property->setMax($data['maximum']);
     }
     if (isset($data['minLength'])) {
         $property->setMinLength($data['minLength']);
     }
     if (isset($data['maxLength'])) {
         $property->setMaxLength($data['maxLength']);
     }
 }
Beispiel #2
0
 /**
  * @return string
  */
 public function getId()
 {
     return md5(parent::getId() . $this->minLength . $this->maxLength);
 }
Beispiel #3
0
 /**
  * @return string
  */
 public function getId()
 {
     return md5(parent::getId() . $this->min . $this->max);
 }
Beispiel #4
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()) . ']');
         }
     }
 }