/** * Searches for value of $key in this context and the parent context. * Returns the value if found, null if not found. * * @param string $key * * @return mixed */ public function tryGet($key) { if (isset($this->stash[$key])) { return $this->stash[$key]; } if ($this->parent && $this->parent->tryGet($key) !== null) { return $this->parent->tryGet($key); } return null; }