/**
* @param ClassMethod $method
* @param bool $isInterface
* @param string $indent
*
* @return string
*/
protected function buildMethod(ClassMethod $method, $isInterface, $indent)
{
$modifier = implode(' ', array_diff($method->getVisibility(), $this->ignoreModifiers));
$methodParameters = $method->getParameters();
$aliasManager = $method->getClassDefinition()->getAliasManager();
$docBlock = new MethodDocBlock($method, $aliasManager, $indent);
$parameters = array();
if ($methodParameters) {
foreach ($methodParameters->getParameters() as $parameter) {
$paramStr = '';
if (isset($parameter['cast'])) {
if ($aliasManager->isAlias($parameter['cast']['value'])) {
$cast = '\\' . $aliasManager->getAlias($parameter['cast']['value']);
} else {
$cast = $parameter['cast']['value'];
}
$paramStr .= $cast . ' ';
}
$paramStr .= '$' . $parameter['name'];
if (isset($parameter['default'])) {
$paramStr .= ' = ' . $this->wrapPHPValue($parameter);
}
$parameters[] = $paramStr;
}
}
$methodBody = $indent . $modifier . ' function ' . $method->getName() . '(' . implode(', ', $parameters) . ')';
if ($isInterface || $method->isAbstract()) {
$methodBody .= ';';
} else {
$methodBody .= ' {}';
}
return $docBlock . "\n" . $methodBody;
}