Habari\HiEngineParser::hi_to_var PHP Метод

hi_to_var() публичный Метод

public hi_to_var ( $hisyntax )
    function hi_to_var($hisyntax)
    {
        $var = str_replace('.', '->', $hisyntax);
        if (count($this->contexts)) {
            // Build a conditional that checks for the most specific, then the least
            // eg.- $a->b->c->d->x, then $a->b->c->x, down to just $x
            $ctx = $this->contexts;
            $prefixes = array();
            foreach ($ctx as $void) {
                $prefixes[] = implode('->', $this->contexts);
                array_pop($ctx);
            }
            $output = '';
            foreach ($prefixes as $prefix) {
                $output .= '(!is_null($' . $prefix . '->' . $var . ') ? $' . $prefix . '->' . $var . ' : ';
            }
            $output .= '$' . $var . ')';
            return $output;
        } else {
            return '$' . $var;
        }
    }