/** * Adds a new Method on collection. * * @param MethodInterface $method * * @return bool * * @throws \InvalidArgumentException */ public function add($method) { if (!$method instanceof MethodInterface) { throw new \InvalidArgumentException('This Method must be a instance of \\ClassGeneration\\MethodInterface'); } if ($method->getName() === null) { $method->setName('method' . ($this->count() + 1)); } parent::set($method->getName(), $method); return true; }
/** * @inheritdoc */ public function addMethod(MethodInterface $method) { $method->setParent($this); $this->getMethodCollection()->add($method); return $this; }