gossi\codegen\utils\ReflectionUtils::getUnindentedDocComment PHP Method

getUnindentedDocComment() public static method

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;
    }

Usage Example

 public function testGetUnindentedDocComment()
 {
     $writer = new Writer();
     $comment = $writer->writeln('/**')->indent()->writeln(' * Foo.')->write(' */')->getContent();
     $this->assertEquals("/**\n * Foo.\n */", ReflectionUtils::getUnindentedDocComment($comment));
 }