function Kint_Parsers_Json::_parse

* main and usually single method a custom parser must implement * *

Parameters

mixed $variable: * * @return mixed [!!!] false is returned if the variable is not of current type

Overrides kintParser::_parse

File

kint/kint/parsers/custom/json.php, line 5

Class

Kint_Parsers_Json

Code

protected function _parse(&$variable) {
    if (!KINT_PHP53 || !is_string($variable) || !isset($variable[0]) || $variable[0] !== '{' && $variable[0] !== '[' || ($json = json_decode($variable, true)) === null) {
        return false;
    }
    $val = (array) $json;
    if (empty($val)) {
        return false;
    }
    $this->value = kintParser::factory($val)->extendedValue;
    $this->type = 'JSON';
}