Code Duplication    Length = 7-7 lines in 2 locations

src/JsonDecoder.php 1 location

@@ 110-116 (lines=7) @@
107
108
        $decoded = $this->decodeJson($json);
109
110
        if (null !== $schema) {
111
            $errors = $this->validator->validate($decoded, $schema);
112
113
            if (count($errors) > 0) {
114
                throw ValidationFailedException::fromErrors($errors);
115
            }
116
        }
117
118
        return $decoded;
119
    }

src/JsonEncoder.php 1 location

@@ 133-139 (lines=7) @@
130
     */
131
    public function encode($data, $schema = null)
132
    {
133
        if (null !== $schema) {
134
            $errors = $this->validator->validate($data, $schema);
135
136
            if (count($errors) > 0) {
137
                throw ValidationFailedException::fromErrors($errors);
138
            }
139
        }
140
141
        $options = 0;
142