Code Duplication    Length = 9-9 lines in 3 locations

src/Fields/BaseField.php 3 locations

@@ 244-252 (lines=9) @@
241
            ]);
242
        }
243
        $constraints = $this->constraints();
244
        if (isset($constraints->pattern)) {
245
            if (!$this->checkPatternConstraint($val, $constraints->pattern)) {
246
                $validationErrors[] = new SchemaValidationError(SchemaValidationError::FIELD_VALIDATION, [
247
                    'field' => $this->name(),
248
                    'value' => $val,
249
                    'error' => 'value does not match pattern',
250
                ]);
251
            }
252
        }
253
        if (
254
            isset($constraints->minimum)
255
            && !$this->checkMinimumConstraint($val, $this->castValueNoConstraints($constraints->minimum))
@@ 273-281 (lines=9) @@
270
                'error' => 'value is above maximum',
271
            ]);
272
        }
273
        if (
274
            isset($constraints->minLength) && !$this->checkMinLengthConstraint($val, $constraints->minLength)
275
        ) {
276
            $validationErrors[] = new SchemaValidationError(SchemaValidationError::FIELD_VALIDATION, [
277
                'field' => $this->name(),
278
                'value' => $val,
279
                'error' => 'value is below minimum length',
280
            ]);
281
        }
282
        if (
283
            isset($constraints->maxLength) && !$this->checkMaxLengthConstraint($val, $constraints->maxLength)
284
        ) {
@@ 282-290 (lines=9) @@
279
                'error' => 'value is below minimum length',
280
            ]);
281
        }
282
        if (
283
            isset($constraints->maxLength) && !$this->checkMaxLengthConstraint($val, $constraints->maxLength)
284
        ) {
285
            $validationErrors[] = new SchemaValidationError(SchemaValidationError::FIELD_VALIDATION, [
286
                'field' => $this->name(),
287
                'value' => $val,
288
                'error' => 'value is above maximum length',
289
            ]);
290
        }
291
292
        return $validationErrors;
293
    }