name = $name; $this->parent = $parent; } public function getFullName(): string { if ($this->parent) { return $this->parent->getFullName() . '/' . $this->name; } return $this->name; } public function get(string $key) { if ($this->has($key)) { return $this->data[$key]; } elseif ($this->parent) { return $this->parent->get($key); } throw new MadLispException("symbol $key not defined in env"); } public function getParent(): ?Env { return $this->parent; } public function getRoot(): ?Env { return $this->parent ? $this->parent->getRoot() : $this; } }