function ClassNode::addMethod
Parameters
MethodNode $method:
bool $force:
Return value
void
File
-
vendor/
phpspec/ prophecy/ src/ Prophecy/ Doubler/ Generator/ Node/ ClassNode.php, line 150
Class
- ClassNode
- Class node.
Namespace
Prophecy\Doubler\Generator\NodeCode
public function addMethod(MethodNode $method, $force = false) {
if (!$this->isExtendable($method->getName())) {
$message = sprintf('Method `%s` is not extendable, so can not be added.', $method->getName());
throw new MethodNotExtendableException($message, $this->getParentClass(), $method->getName());
}
if ($force || !isset($this->methods[$method->getName()])) {
$this->methods[$method->getName()] = $method;
}
}