public function addMethod(ClassMethodNode $node)
{
$method = new ReflectionMethod($node->name);
$method->setStartLine((int) $node->getAttribute('startLine'));
$method->setEndLine((int) $node->getAttribute('endLine'));
$method->setDocComment((string) $node->getDocComment());
$method->setReturnsByRef((bool) $node->returnsByRef());
$method->setFinal((bool) $node->isFinal());
$method->setStatic((bool) $node->isStatic());
$this->addFunctionLikeParameters($method, $node->params);
// All functions in an interface are implicitly abstract. There is no need to use the abstract keyword when declaring the function.
if ($this->context->getReflection() instanceof ReflectionInterface) {
$method->setAbstract(true);
} else {
$method->setAbstract((bool) $node->isAbstract());
}
if ($node->isPrivate()) {
$method->setVisibility(ReflectionMethod::IS_PRIVATE);
} elseif ($node->isProtected()) {
$method->setVisibility(ReflectionMethod::IS_PROTECTED);
} else {
$method->setVisibility(ReflectionMethod::IS_PUBLIC);
}
$this->context->getReflection()->addMethod($method);
$this->context->enterFunctionLike($method);
}