JsonDecoder   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 19
rs 10
c 1
b 0
f 0
wmc 4
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A decode() 0 8 4
1
<?php
2
3
namespace Abraham\TwitterOAuth\Util;
4
5
/**
6
 * @author louis <[email protected]>
7
 */
8
class JsonDecoder
9
{
10
    /**
11
     * Decodes a JSON string to stdObject or associative array
12
     *
13
     * @param string $string
14
     * @param bool   $asArray
15
     *
16
     * @return array|object
17
     */
18
    public static function decode($string, $asArray)
19
    {
20
        if (version_compare(PHP_VERSION, '5.4.0', '>=') && !(defined('JSON_C_VERSION') && PHP_INT_SIZE > 4)) {
21
            return json_decode($string, $asArray, 512, JSON_BIGINT_AS_STRING);
22
        }
23
24
        return json_decode($string, $asArray);
25
    }
26
}
27