Code Duplication    Length = 16-18 lines in 2 locations

src/Json/JsonStorage.php 2 locations

@@ 205-220 (lines=16) @@
202
        }
203
    }
204
205
    private function loadFile($path, $className, array $options = array())
206
    {
207
        $json = $this->storage->read($path);
208
        $jsonData = $this->decode($json, $path);
209
        $options['path'] = $path;
210
211
        try {
212
            return $this->converterProvider->getJsonConverter($className)->fromJson($jsonData, $options);
213
        } catch (ConversionFailedException $e) {
214
            throw new InvalidConfigException(sprintf(
215
                'The JSON in %s could not be converted: %s',
216
                $path,
217
                $e->getMessage()
218
            ), 0, $e);
219
        }
220
    }
221
222
    private function saveFile($file, $path, array $options = array())
223
    {
@@ 222-239 (lines=18) @@
219
        }
220
    }
221
222
    private function saveFile($file, $path, array $options = array())
223
    {
224
        $className = get_class($file);
225
226
        try {
227
            $jsonData = $this->converterProvider->getJsonConverter($className)->toJson($file, $options);
228
        } catch (ConversionFailedException $e) {
229
            throw new InvalidConfigException(sprintf(
230
                'The data written to %s could not be converted: %s',
231
                $path,
232
                $e->getMessage()
233
            ), 0, $e);
234
        }
235
236
        $json = $this->encode($jsonData, $path);
237
238
        $this->storage->write($path, $json);
239
    }
240
241
    private function encode(stdClass $jsonData, $path)
242
    {