public static function v($cx, $in, $base, $path, $args = null) {
        $count = count($cx['scopes']);
        $plen = count($path);
        while ($base) {
            $v = $base;
            foreach ($path as $i => $name) {
                if (is_array($v)) {
                    if (isset($v[$name])) {
                        $v = $v[$name];
                        continue;
                    }
                    if (($i === $plen - 1) && ($name === 'length')) {
                        return count($v);
                    }
                }
                if (is_object($v)) {
                    if ($cx['flags']['prop'] && !($v instanceof \Closure) && isset($v->$name)) {
                        $v = $v->$name;
                        continue;
                    }
                    if ($cx['flags']['method'] && is_callable(array($v, $name))) {
                        $v = $v->$name();
                        continue;
                    }
                }
                if ($cx['flags']['mustlok']) {
                    unset($v);
                    break;
                }
                return null;
            }
            if (isset($v)) {
                if ($v instanceof \Closure) {
                    if ($cx['flags']['mustlam'] || $cx['flags']['lambda']) {
                        if (!$cx['flags']['knohlp'] && ($args || ($args === 0))) {
                            $A = $args ? $args[0] : array();
                            $A[] = array('hash' => $args[1], '_this' => $in);
                        } else {
                            $A = array($in);
                        }
                        $v = call_user_func_array($v, $A);
                    }
                }
                return $v;
            }
            $count--;
            switch ($count) {
                case -1:
                    $base = $cx['sp_vars']['root'];
                    break;
                case -2:
                    return null;
                default:
                    $base = $cx['scopes'][$count];
            }
        }
        if ($args) {
            static::err($cx, 'Can not find helper or lambda: "' . implode('.', $path) . '" !');
        }
    }
public static function v($cx, $in, $base, $path, $args = null) {
        $count = count($cx['scopes']);
        $plen = count($path);
        while ($base) {
            $v = $base;
            foreach ($path as $i => $name) {
                if (is_array($v)) {
                    if (isset($v[$name])) {
                        $v = $v[$name];
                        continue;
                    }
                    if (($i === $plen - 1) && ($name === 'length')) {
                        return count($v);
                    }
                }
                if (is_object($v)) {
                    if ($cx['flags']['prop'] && !($v instanceof \Closure) && isset($v->$name)) {
                        $v = $v->$name;
                        continue;
                    }
                    if ($cx['flags']['method'] && is_callable(array($v, $name))) {
                        $v = $v->$name();
                        continue;
                    }
                }
                if ($cx['flags']['mustlok']) {
                    unset($v);
                    break;
                }
                return null;
            }
            if (isset($v)) {
                if ($v instanceof \Closure) {
                    if ($cx['flags']['mustlam'] || $cx['flags']['lambda']) {
                        if (!$cx['flags']['knohlp'] && ($args || ($args === 0))) {
                            $A = $args ? $args[0] : array();
                            $A[] = array('hash' => $args[1], '_this' => $in);
                        } else {
                            $A = array($in);
                        }
                        $v = call_user_func_array($v, $A);
                    }
                }
                return $v;
            }
            $count--;
            switch ($count) {
                case -1:
                    $base = $cx['sp_vars']['root'];
                    break;
                case -2:
                    return null;
                default:
                    $base = $cx['scopes'][$count];
            }
        }
        if ($args) {
            static::err($cx, 'Can not find helper or lambda: "' . implode('.', $path) . '" !');
        }
    }
public static function v ( $ cx , $ in , $ base , $ path , $ args = null ) { $ count = count ( $ cx [ 'scopes' ] ) ; $ plen = count ( $ path ) ; while ( $ base ) { $ v = $ base ; foreach ( $ path as $ i => $ name ) { if ( is_array ( $ v ) ) { if ( isset ( $ v [ $ name ] ) ) { $ v = $ v [ $ name ] ; continue ; } if ( ( $ i === $ plen - 1 ) && ( $ name === 'length' ) ) { return count ( $ v ) ; } } if ( is_object ( $ v ) ) { if ( $ cx [ 'flags' ] [ 'prop' ] && ! ( $ v instanceof \ Closure ) && isset ( $ v -> $ name ) ) { $ v = $ v -> $ name ; continue ; } if ( $ cx [ 'flags' ] [ 'method' ] && is_callable ( array ( $ v , $ name ) ) ) { $ v = $ v -> $ name ( ) ; continue ; } } if ( $ cx [ 'flags' ] [ 'mustlok' ] ) { unset ( $ v ) ; break ; } return null ; } if ( isset ( $ v ) ) { if ( $ v instanceof \ Closure ) { if ( $ cx [ 'flags' ] [ 'mustlam' ] || $ cx [ 'flags' ] [ 'lambda' ] ) { if ( ! $ cx [ 'flags' ] [ 'knohlp' ] && ( $ args || ( $ args === 0 ) ) ) { $ A = $ args ? $ args [ 0 ] : array ( ) ; $ A [ ] = array ( 'hash' => $ args [ 1 ] , '_this' => $ in ) ; } else { $ A = array ( $ in ) ; } $ v = call_user_func_array ( $ v , $ A ) ; } } return $ v ; } $ count -- ; switch ( $ count ) { case - 1 : $ base = $ cx [ 'sp_vars' ] [ 'root' ] ; break ; case - 2 : return null ; default : $ base = $ cx [ 'scopes' ] [ $ count ] ; } } if ( $ args ) { static :: err ( $ cx , 'Can not find helper or lambda: "' . implode ( '.' , $ path ) . '" !' ) ; } }
Resursive lookup variable and helpers. This is slow and will only be used for instance property or method detection or lambdas.

@param array<string,array|string|integer> $cx render time context for lightncandy
@param array|string|boolean|integer|double|null $in current context
@param array<array|string|integer> $base current variable context
@param array<string|integer> $path array of names for path
@param array|null $args extra arguments for lambda

@return null|string Return the value or null when not found

@expect null when input array('scopes' => array(), 'flags' => array('prop' => 0, 'method' => 0, 'mustlok' => 0)), null, 0, array('a', 'b')
@expect 3 when input array('scopes' => array(), 'flags' => array('prop' => 0, 'method' => 0), 'mustlok' => 0), null, array('a' => array('b' => 3)), array('a', 'b')
@expect null when input array('scopes' => array(), 'flags' => array('prop' => 0, 'method' => 0, 'mustlok' => 0)), null, (Object) array('a' => array('b' => 3)), array('a', 'b')
@expect 3 when input array('scopes' => array(), 'flags' => array('prop' => 1, 'method' => 0, 'mustlok' => 0)), null, (Object) array('a' => array('b' => 3)), array('a', 'b')
Resursive lookup variable and helpers . This is slow and will only be used for instance property or method detection or lambdas .