protected function _parseTokens($item) {
        $results = [];
        while ($item !== null) {
            switch ($item['token']) {
                case '}':
                    return $results;

                case '{':
                    $item['children'] = $this->_parseTokens(array_shift($this->_tokens));
                    $results[] = $item;
                    break;

                default:
                    $results[] = $item;
            }

            $item = array_shift($this->_tokens);
        }
        return $results;
    }
protected function _parseTokens($item) {
        $results = [];
        while ($item !== null) {
            switch ($item['token']) {
                case '}':
                    return $results;

                case '{':
                    $item['children'] = $this->_parseTokens(array_shift($this->_tokens));
                    $results[] = $item;
                    break;

                default:
                    $results[] = $item;
            }

            $item = array_shift($this->_tokens);
        }
        return $results;
    }
protected function _parseTokens ( $ item ) { $ results = [ ] ; while ( $ item !== null ) { switch ( $ item [ 'token' ] ) { case '}' : return $ results ; case '{' : $ item [ 'children' ] = $ this -> _parseTokens ( array_shift ( $ this -> _tokens ) ) ; $ results [ ] = $ item ; break ; default : $ results [ ] = $ item ; } $ item = array_shift ( $ this -> _tokens ) ; } return $ results ; }
Convert to tree

@param array $item
@return array
Convert to tree