@@ 211-219 (lines=9) @@ | ||
208 | ]); |
|
209 | } |
|
210 | $constraints = $this->constraints(); |
|
211 | if (isset($constraints->pattern)) { |
|
212 | if (!$this->checkPatternConstraint($val, $constraints->pattern)) { |
|
213 | $validationErrors[] = new SchemaValidationError(SchemaValidationError::FIELD_VALIDATION, [ |
|
214 | "field" => $this->name(), |
|
215 | "value" => $val, |
|
216 | "error" => "value does not match pattern" |
|
217 | ]); |
|
218 | } |
|
219 | } |
|
220 | if ( |
|
221 | isset($constraints->minimum) |
|
222 | && !$this->checkMinimumConstraint($val, $this->castValueNoConstraints($constraints->minimum)) |
|
@@ 240-248 (lines=9) @@ | ||
237 | "error" => "value is above maximum" |
|
238 | ]); |
|
239 | } |
|
240 | if ( |
|
241 | isset($constraints->minLength) && !$this->checkMinLengthConstraint($val, $constraints->minLength) |
|
242 | ) { |
|
243 | $validationErrors[] = new SchemaValidationError(SchemaValidationError::FIELD_VALIDATION, [ |
|
244 | "field" => $this->name(), |
|
245 | "value" => $val, |
|
246 | "error" => "value is below minimum length" |
|
247 | ]); |
|
248 | } |
|
249 | if ( |
|
250 | isset($constraints->maxLength) && !$this->checkMaxLengthConstraint($val, $constraints->maxLength) |
|
251 | ) { |
|
@@ 249-257 (lines=9) @@ | ||
246 | "error" => "value is below minimum length" |
|
247 | ]); |
|
248 | } |
|
249 | if ( |
|
250 | isset($constraints->maxLength) && !$this->checkMaxLengthConstraint($val, $constraints->maxLength) |
|
251 | ) { |
|
252 | $validationErrors[] = new SchemaValidationError(SchemaValidationError::FIELD_VALIDATION, [ |
|
253 | "field" => $this->name(), |
|
254 | "value" => $val, |
|
255 | "error" => "value is above maximum length" |
|
256 | ]); |
|
257 | } |
|
258 | return $validationErrors; |
|
259 | } |
|
260 |