public function attr($name, $value = null) { if ($value === null) { return $this->getAttribute($name); } $this->setAttribute($name, $value); return $this; }