private function buildMagicMethod($magicMethod)
{
$docBlock = new DocBlockStripSpaces(substr($magicMethod->getDescription(), 1, -1));
$fullDescription = $docBlock->getText();
$resources = $docBlock->getTagsByName('see');
$params = $docBlock->getTagsByName('param');
$exceptions = $docBlock->getTagsByName('throws');
$returns = $docBlock->getTagsByName('return');
$docText = '';
$examples = null;
$parts = explode('Example:', $fullDescription);
$docText = $parts[0];
if (strpos($fullDescription, 'Example:') !== false) {
$examples = $parts[1];
}
return ['id' => $magicMethod->getMethodName(), 'type' => $magicMethod->getMethodName() === '__construct' ? 'constructor' : 'instance', 'name' => $magicMethod->getMethodName(), 'source' => $this->outputName, 'description' => $this->buildDescription($docBlock, $docText), 'examples' => $this->buildExamples($examples), 'resources' => $this->buildResources($resources), 'params' => $this->buildParams($params), 'exceptions' => $this->buildExceptions($exceptions), 'returns' => $this->buildReturns($returns)];
}