protected function formatTags()
{
$tags = null;
$tagLength = $this->getTagLength();
// Format basic tags
foreach ($this->tags as $tag => $desc) {
if ($tag != 'param' && $tag != 'return' && $tag != 'throws') {
$tags .= $this->indent . ' * @' . $tag . str_repeat(' ', $tagLength - strlen($tag) + 1) . $desc . PHP_EOL;
}
}
// Format param tags
foreach ($this->tags['param'] as $param) {
$paramLength = $this->getParamLength();
$tags .= $this->indent . ' * @param' . str_repeat(' ', $tagLength - 4) . $param['type'] . str_repeat(' ', $paramLength - strlen($param['type']) + 1) . $param['var'];
if (null !== $param['desc']) {
$tags .= ' ' . $param['desc'] . PHP_EOL;
} else {
$tags .= PHP_EOL;
}
}
// Format throw tag
if (array_key_exists('throws', $this->tags)) {
$tags .= $this->indent . ' * @throws' . str_repeat(' ', $tagLength - 5) . $this->tags['throws'] . PHP_EOL;
}
// Format return tag
if (array_key_exists('return', $this->tags)) {
$tags .= $this->indent . ' * @return' . str_repeat(' ', $tagLength - 5) . $this->tags['return']['type'];
if (null !== $this->tags['return']['desc']) {
$tags .= ' ' . $this->tags['return']['desc'] . PHP_EOL;
} else {
$tags .= PHP_EOL;
}
}
return null !== $tags && null !== $this->desc ? $this->indent . ' * ' . PHP_EOL . $tags : $tags;
}