Version 1
[yaffs-website] / web / modules / contrib / devel / kint / kint / parsers / custom / json.php
1 <?php
2
3 class Kint_Parsers_Json extends kintParser
4 {
5         protected function _parse( & $variable )
6         {
7                 if ( !KINT_PHP53
8                         || !is_string( $variable )
9                         || !isset( $variable{0} ) || ( $variable{0} !== '{' && $variable{0} !== '[' )
10                         || ( $json = json_decode( $variable, true ) ) === null
11                 ) return false;
12
13                 $val = (array) $json;
14                 if ( empty( $val ) ) return false;
15
16                 $this->value = kintParser::factory( $val )->extendedValue;
17                 $this->type  = 'JSON';
18         }
19 }