public function &__get($key) { if (array_key_exists($key, $this->_data)) { return $this->_data[$key]; } if ($this->_parent !== null) { return $this->_parent->__get($key); } throw new Exception("Undefined variable `{$key}`."); }