]> git.mxchange.org Git - friendica-addons.git/blob - twitter/vendor/abraham/twitteroauth/src/Util/JsonDecoder.php
Add explicit dependencies to twitter addon
[friendica-addons.git] / twitter / vendor / abraham / twitteroauth / src / Util / JsonDecoder.php
1 <?php
2
3 namespace Abraham\TwitterOAuth\Util;
4
5 /**
6  * @author louis <louis@systemli.org>
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 }