public function resolve($var)
    {

        # if $var is array - it contains filters to apply
        $filters = array();
        if (is_array($var)) {
            $name = array_shift($var);
            $filters = isset($var['filters']) ? $var['filters'] : array();
        } else {
            $name = $var;
        }

        $result = null;

        # Lookup basic types, null, boolean, numeric and string
        # Variable starts with : (:users.name) to short-circuit lookup
        if ($name[0] === ':') {
            $object = $this->getVariable(substr($name, 1));
            if (!is_null($object)) {
                $result = $object;
            }
        } else {
            if ($name === 'true') {
                $result = true;
            } elseif ($name === 'false') {
                $result = false;
            } elseif (preg_match('/^-?\d+(\.\d+)?$/', $name, $matches)) {
                $result = isset($matches[1]) ? floatval($name) : intval($name);
            } elseif (preg_match('/^"([^"\\\\]*(?:\\.[^"\\\\]*)*)"|'.
                           '\'([^\'\\\\]*(?:\\.[^\'\\\\]*)*)\'$/', $name)) {
                $result = stripcslashes(substr($name, 1, -1));
            }
        }
        if (!empty(self::$lookupTable) && $result == null) {
            $result = $this->externalLookup($name);
        }
        $result = $this->applyFilters($result, $filters);

        return $result;
    }