Code Duplication    Length = 12-12 lines in 2 locations

src/Support/Json.php 2 locations

@@ 24-35 (lines=12) @@
21
     * @return string
22
     * @throws JsonParseException
23
     */
24
    public static function encode($value, $options = 0, $depth = 512)
25
    {
26
        $json = \json_encode($value, $options, $depth);
27
        if (JSON_ERROR_NONE !== json_last_error()) {
28
            throw new JsonParseException(
29
                'json_encode error: ' . json_last_error_msg(),
30
                json_last_error()
31
            );
32
        }
33
34
        return $json;
35
    }
36
37
    /**
38
     * Decodes a JSON string
@@ 48-59 (lines=12) @@
45
     * @return mixed
46
     * @throws JsonParseException
47
     */
48
    public static function decode($json, $assoc = false, $depth = 512, $options = 0)
49
    {
50
        $data = \json_decode($json, $assoc, $depth, $options);
51
        if (JSON_ERROR_NONE !== json_last_error()) {
52
            throw new JsonParseException(
53
                'json_decode error: ' . json_last_error_msg(),
54
                json_last_error()
55
            );
56
        }
57
58
        return $data;
59
    }
60
}
61