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']); } }
/** * @return string */ public function getId() { return md5(parent::getId() . $this->minLength . $this->maxLength); }
/** * @return string */ public function getId() { return md5(parent::getId() . $this->min . $this->max); }
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()) . ']'); } } }