public static getUnindentedDocComment ( string $docComment ) | ||
$docComment | string |
public static function getUnindentedDocComment($docComment)
{
$lines = explode("\n", $docComment);
for ($i = 0, $c = count($lines); $i < $c; $i++) {
if (0 === $i) {
$docBlock = $lines[0] . "\n";
continue;
}
$docBlock .= ' ' . ltrim($lines[$i]);
if ($i + 1 < $c) {
$docBlock .= "\n";
}
}
return $docBlock;
}
public function testGetUnindentedDocComment() { $writer = new Writer(); $comment = $writer->writeln('/**')->indent()->writeln(' * Foo.')->write(' */')->getContent(); $this->assertEquals("/**\n * Foo.\n */", ReflectionUtils::getUnindentedDocComment($comment)); }