Decodes a json file string
@param  string $string File contents
@return array
974633
public static function decode($string)
    {
        $xml = simplexml_load_string($string);
        $array = array($xml->getName() => (array) $xml);
        $array = self::loopDecode($array);

        return $array;
    }
1196539
public function loadString($string)
    {
        $this->string = htmlspecialchars_decode($string);

        if ($this->config[ 'allowPhpScripts' ] === false) {
            $this->string = preg_replace(
                '/<\\?.*(\\?>|$)/Us',
                '',
                str_replace('<?=', '<?php echo ', $this->string)
            );
        }

        return (bool)empty($this->string);
    }
855601
public function decode($string)
    {
        $i = 0;

        foreach(str_split($string) as $char)
        {
            $i = $i * $this->radix + array_search($char, $this->dictionary);
        }

        return $i;
    }
703269
public static function isJson($string)
    {
        if (!is_string($string) || (is_string($string)
                && substr($string, 0, 1) !== '{'
                && substr($string, 0, 1) !== '[')
        ) {
            return false;
        }
        @json_decode($string);
        return (json_last_error() == JSON_ERROR_NONE);
    }
612374
public function convert($string)
    {
        $json = json_decode($string, true);
        if (JSON_ERROR_NONE !== ($jsonErrorCode = json_last_error())) {
            $message = "An error occured while decoding the JSON input:\n";
            $message .= $this->jsonDecodeErrorMessage($jsonErrorCode);
            $message .= "\nInput JSON:\n\n" . $string;
            throw new ParserException($message);
        }

        return $json;
    }
604949
protected function decode($string)
    {
        $charset = $this->getDataCharset();
        if ($charset !== $this->getConnectionCharset()) {
            $string = iconv($this->getConnectionCharset(), $charset, $string);
        }
        if (get_magic_quotes_gpc()) {
            $string = stripslashes($string);
        }

        return $string;
    }
654971
public function decode($string)
    {
        if ($this->isSerialized($string)) {
            return $this->unserialize($string);
        }

        $result = json_decode($string, true);
        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new \InvalidArgumentException('Unable to unserialize value.');
        }

        return $result;
    }
533495
public static function isJSON(string $string) : bool
    {
        if (empty($string)) {
            return false;
        }

        $object = json_decode($string);

        return is_string($string) && json_last_error() === JSON_ERROR_NONE;
    }
67019
public static function decode($string)
    {
        return ($string === self::NULL) ? null : strtr($string, self::$decodeMap);
    }
581771
private static function decodeInt($string)
    {
        // Get info on the first char.
        list($firstHex, $firstOctal) = self::analyzeFirstChar($string[0]);

        if (hexdec($firstHex) < pow(2, 7)) {
            // fixint 0xxxxxxx
            $int = hexdec($firstHex);
            return array($int, substr($string, 1));
        } elseif (hexdec($firstOctal) > 13) {
            // negative fixint 111xxxxx
            // TODO
        } elseif ($firstHex === 'cc') {
            // uint 8
            // TODO
        } elseif ($firstHex === 'cd') {
            // uint 16
            // TODO
        } elseif ($firstHex === 'ce') {
            // uint 32
            // TODO
        } elseif ($firstHex === 'cf') {
            // uint 64
            // TODO
        } elseif ($firstHex === 'd0') {
            // int 8
            // TODO
        } elseif ($firstHex === 'd1') {
            // int 16
            // TODO
        } elseif ($firstHex === 'd2') {
            // int 32
            // TODO
        } elseif ($firstHex === 'd3') {
            // int 64
            // TODO
        }
        return array(0, substr($string, 1));
    }
162895
public function parseString($string)
    {
        //argument 1 must be a string
        Argument::i()->test(1, 'string');
        
        foreach ($this->data as $key => $value) {
            $string = str_replace($key, $value, $string);
        }

        return $string;
    }
256815
private function isJsonString($string)
    {
        if (! is_string($string)) {
            return false;
        }
        
        $firstChar = substr($string, 0, 1);
        
        // If it starts the way a JSON object or array would, and parsing it as
        // JSON returns no errors, consider it a JSON string.
        if (($firstChar === '{') || ($firstChar === '[')) {
            json_decode($string);
            return (json_last_error() == JSON_ERROR_NONE);
        }
        
        return false;
    }
534181
public static function decodeFromFile($path)
    {
        if (!is_file($path)) {
            throw new \Exception("File does not exist: {$path}");
        }

        $string = file_get_contents($path);

        if ($string === false) {
            throw new \Exception("Failed to read the file: {$path}");
        }

        if (!$string) {
            return [];
        }

        $array = json_decode($string, true);

        static::checkLastError();

        return $array;
    }
23537
public function loadString(&$string): array
    {
        /** @noinspection CallableParameterUseCaseInTypeContextInspection */
        $string = $this->unwrap($string);
        $this->rawSegments = $string;

        return $this->parse($string);
    }
961870
protected function parseHeaders($string) 
    {
        $headers = array();
        $lines = explode("\r\n", trim($string));
        foreach($lines as $line) {
            @list($key, $val) = explode(':', $line, 2);
            $key = strtolower(trim($key));
            $val = trim($val);
            if(empty($val)) continue;
            if(isset($headers[$key])) {
                if(is_array($headers[$key])) {
                    $headers[$key][] = $val;
                } else {
                    $headers[$key] = array($headers[$key], $val);
                }
            } else {
                $headers[$key] = $val;
            }
        }
        return $headers;
    }
707706
public static function base64Decode($string)
    {
        if (is_array($string) || is_object($string)) {
            $caller =  next(debug_backtrace());
            $eror['line']  = $caller['line'];
            $eror['file']  = strip_tags($caller['file']);
            trigger_error(
                "base64Decode() expects parameter 1 to be string, "
                . gettype($string)
                . " given in <b>{$eror['file']}</b> on line <b>{$eror['line']}</b><br />\n",
                E_USER_ERROR
            );

            return false;
        }

        /**
         * Use Internal
         */
        if (function_exists('base64_decode')) {
            return base64_decode($string);
        }

        if (strlen($string) <= 0) {
            return '';
        }

        $keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
        $i = 0;
        $output = "";
        // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
        $string = preg_replace("[^A-Za-z0-9\+\/\=]", "", $string);
        do {
            $enc1 = strpos($keyStr, substr($string, $i++, 1));
            $enc2 = strpos($keyStr, substr($string, $i++, 1));
            $enc3 = strpos($keyStr, substr($string, $i++, 1));
            $enc4 = strpos($keyStr, substr($string, $i++, 1));
            $chr1 = ($enc1 << 2) | ($enc2 >> 4);
            $chr2 = (($enc2 & 15) << 4) | ($enc3 >> 2);
            $chr3 = (($enc3 & 3) << 6) | $enc4;
            $output = $output . chr((int) $chr1);
            if ($enc3 != 64) {
                $output = $output . chr((int) $chr2);
            }
            if ($enc4 != 64) {
                $output = $output . chr((int) $chr3);
            }
        } while ($i < strlen($string));

        return urldecode($output);
    }
909975
public static function decodeURLSafe($string)
    {
        $remainder = strlen($string) % 4;

        if ($remainder <> 0) {
            $paddingLength = 4 - $remainder;
            $string .= str_repeat('=', $paddingLength);
        }

        return base64_decode(str_replace(array('-', '_'), array('+', '/'), $string));
    }