public function getAttribute(string $key) { $inAttributes = array_key_exists($key, $this->attributes); if ($inAttributes) { return $this->attributes[$key]; } elseif ($key == 'attributes') { return $this->attributes; } }