Completed
Push — master ( 5601ad...d1b5e7 )
by Colin
01:45
created

global.php ➔ json5_decode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 4
dl 0
loc 4
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
if (!function_exists('json5_decode')) {
4
    /**
5
     * Takes a JSON encoded string and converts it into a PHP variable.
6
     *
7
     * The parameters exactly match PHP's json_decode() function - see
8
     * http://php.net/manual/en/function.json-decode.php for more information.
9
     *
10
     * @param string $source      The JSON string being decoded.
11
     * @param bool   $associative When TRUE, returned objects will be converted into associative arrays.
12
     * @param int    $depth       User specified recursion depth.
13
     * @param int    $options     Bitmask of JSON decode options.
14
     *
15
     * @return mixed
16
     */
17
    function json5_decode($source, $associative = false, $depth = 512, $options = 0)
18
    {
19 3
        return \ColinODell\Json5\Json5Decoder::decode($source, $associative, $depth, $options);
20
    }
21
}
22
23
// PHP 5.3 compatibility
24
if (!defined('JSON_BIGINT_AS_STRING')) {
25
    define('JSON_BIGINT_AS_STRING', 2);
26
}
27
if (!defined('JSON_OBJECT_AS_ARRAY')) {
28
    define('JSON_OBJECT_AS_ARRAY', 1);
29
}
30