@@ 229-237 (lines=9) @@ | ||
226 | ]); |
|
227 | } |
|
228 | $constraints = $this->constraints(); |
|
229 | if (isset($constraints->pattern)) { |
|
230 | if (!$this->checkPatternConstraint($val, $constraints->pattern)) { |
|
231 | $validationErrors[] = new SchemaValidationError(SchemaValidationError::FIELD_VALIDATION, [ |
|
232 | 'field' => $this->name(), |
|
233 | 'value' => $val, |
|
234 | 'error' => 'value does not match pattern', |
|
235 | ]); |
|
236 | } |
|
237 | } |
|
238 | if ( |
|
239 | isset($constraints->minimum) |
|
240 | && !$this->checkMinimumConstraint($val, $this->castValueNoConstraints($constraints->minimum)) |
|
@@ 258-266 (lines=9) @@ | ||
255 | 'error' => 'value is above maximum', |
|
256 | ]); |
|
257 | } |
|
258 | if ( |
|
259 | isset($constraints->minLength) && !$this->checkMinLengthConstraint($val, $constraints->minLength) |
|
260 | ) { |
|
261 | $validationErrors[] = new SchemaValidationError(SchemaValidationError::FIELD_VALIDATION, [ |
|
262 | 'field' => $this->name(), |
|
263 | 'value' => $val, |
|
264 | 'error' => 'value is below minimum length', |
|
265 | ]); |
|
266 | } |
|
267 | if ( |
|
268 | isset($constraints->maxLength) && !$this->checkMaxLengthConstraint($val, $constraints->maxLength) |
|
269 | ) { |
|
@@ 267-275 (lines=9) @@ | ||
264 | 'error' => 'value is below minimum length', |
|
265 | ]); |
|
266 | } |
|
267 | if ( |
|
268 | isset($constraints->maxLength) && !$this->checkMaxLengthConstraint($val, $constraints->maxLength) |
|
269 | ) { |
|
270 | $validationErrors[] = new SchemaValidationError(SchemaValidationError::FIELD_VALIDATION, [ |
|
271 | 'field' => $this->name(), |
|
272 | 'value' => $val, |
|
273 | 'error' => 'value is above maximum length', |
|
274 | ]); |
|
275 | } |
|
276 | ||
277 | return $validationErrors; |
|
278 | } |