Code Duplication    Length = 10-12 lines in 3 locations

src/UI/Resolver/Validator/Implementation/Pure/DateValidatorTrait.php 2 locations

@@ 25-34 (lines=10) @@
22
        $dateValidation = new DateValidation();
23
        $this->validationEngine->validateFieldValue(
24
            $parentValidator ?: $this,
25
            function() use ($value, $propertyPath, $exceptionMessage, $dateValidation) {
26
                if (null === $value || ! $dateValidation->isDateValid($value)) {
27
                    throw new InvalidArgumentException(
28
                        $exceptionMessage ?: sprintf('Date "%s" format invalid, must be Y-m-d.', $value),
29
                        0,
30
                        $propertyPath,
31
                        $value
32
                    );
33
                }
34
            }
35
        );
36
37
        if (null === $value) {
@@ 61-70 (lines=10) @@
58
59
        $this->validationEngine->validateFieldValue(
60
            $parentValidator ?: $this,
61
            function() use ($value, $propertyPath, $exceptionMessage, $dateValidation) {
62
                if (null === $value || ! $dateValidation->isDateTimeValid($value)) {
63
                    throw new InvalidArgumentException(
64
                        $exceptionMessage ?: sprintf('Datetime "%s" format invalid, must be Y-m-d\TH:i:sP (RFC3339). Ex: 2016-06-01T00:00:00+00:00.', $value),
65
                        0,
66
                        $propertyPath,
67
                        $value
68
                    );
69
                }
70
            }
71
        );
72
73
        if (null === $value) {

src/UI/Resolver/Validator/PragmaticRawValueValidator.php 1 location

@@ 106-117 (lines=12) @@
103
    {
104
        $this->validationEngine->validateFieldValue(
105
            $parentValidator ?: $this,
106
            function() use ($value, $pattern, $propertyPath, $exceptionMessage) {
107
                if (preg_match($pattern, $value)) {
108
109
                } else {
110
                    throw new InvalidArgumentException(
111
                        $exceptionMessage ?: sprintf('Value "%s" not valid against regex "%s".', $value, $pattern),
112
                        0,
113
                        $propertyPath,
114
                        $value
115
                    );
116
                }
117
            }
118
        );
119
120
        return $value;