public function clearMethods() { foreach ($this->methods as $method) { $method->setParent(null); } $this->methods->clear(); return $this; }