Code Duplication    Length = 14-14 lines in 2 locations

src/Constraints/Format.php 1 location

@@ 87-100 (lines=14) @@
84
     *
85
     * @return \League\JsonGuard\ValidationError|null
86
     */
87
    private static function validateRegex($format, $value, $pattern, $errorCode, $pointer)
88
    {
89
        if (!is_string($value) || preg_match($pattern, $value) === 1) {
90
            return null;
91
        }
92
93
        return new ValidationError(
94
            'Value {value} does not match the format {format}',
95
            $errorCode,
96
            $value,
97
            $pointer,
98
            ['value' => $value, 'format' => $format]
99
        );
100
    }
101
102
    /**
103
     * @param string $format

src/Constraints/Type.php 1 location

@@ 70-83 (lines=14) @@
67
     *
68
     * @return \League\JsonGuard\ValidationError|null
69
     */
70
    private static function validateType($value, $type, callable $callable, $errorCode, $pointer)
71
    {
72
        if (call_user_func($callable, $value) === true) {
73
            return null;
74
        }
75
76
        return new ValidationError(
77
            'Value {value} is not a(n) {type}',
78
            $errorCode,
79
            $value,
80
            $pointer,
81
            ['value' => $value, 'type' => $type]
82
        );
83
    }
84
85
    /**
86
     * @param mixed  $value