| 1 | <?php |
||
| 6 | class CommentsFormatter extends SpecializedFormatter { |
||
| 7 | |||
| 8 | 2 | protected function doVisitToken(Token $token) { |
|
| 9 | // multiline |
||
| 10 | 2 | if ($token->type == T_DOC_COMMENT |
|
| 11 | 2 | || $token->type == T_INLINE_HTML && strpos($token->contents, '/*') !== 0) { |
|
| 12 | |||
| 13 | $lines = explode("\n", $token->contents); |
||
| 14 | $firstLine = array_shift($lines); |
||
| 15 | $this->writer->writeln(); |
||
| 16 | $this->writer->writeln($firstLine); |
||
| 17 | |||
| 18 | foreach ($lines as $line) { |
||
| 19 | $this->writer->writeln(' ' . ltrim($line)); |
||
| 20 | } |
||
| 21 | |||
| 22 | $this->defaultFormatter->hideToken(); |
||
| 23 | } |
||
| 24 | 2 | } |
|
| 25 | |||
| 26 | 5 | public static function isComment(Token $token) { |
|
| 31 | } |
||
| 32 |