Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php |
||
| 28 | class CliFormatter extends AbstractFormatter implements FormatterInterface |
||
| 29 | {
|
||
| 30 | private $_styles = []; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * CliFormatter constructor. |
||
| 34 | */ |
||
| 35 | 36 | View Code Duplication | public function __construct(array $options = []) |
| 43 | |||
| 44 | 2 | public function format(Tokens $tokens) |
|
| 48 | |||
| 49 | 2 | protected function token(Token $token) |
|
| 61 | |||
| 62 | protected function formatLineStart($line) |
||
| 66 | |||
| 67 | protected function formatLineEnd($line) |
||
| 71 | } |
||
| 72 |