bindings = $bindings; $this->parent = $parent; } /** * Looks up the value of a symbol in this context and returns it. * The reserved symbol "this" is an alias for the current context. * * @param string $key symbol name */ public function lookup($key) { if (isset($this->bindings[$key])) { return $this->bindings[$key]; } else if ($this->parent) { return $this->parent->lookup($key); } return NULL; } /** * Enables or disables automatic escaping for template values. * * @param callable $escape escape callback or NULL */ public function autoescape($escape) { $this->escape = $escape; } /** * Escapes the given value using the configured strategy. * * @param mixed $value expression value */ public function escape($value) { if (isset($this->escape)) { $value = call_user_func($this->escape, $value); } else if ($this->parent) { $value = $this->parent->escape($value); } return $value; } }