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 |
||
| 16 | class TestRunner |
||
| 17 | { |
||
| 18 | /** |
||
| 19 | * @var Application |
||
| 20 | */ |
||
| 21 | private $app; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * @var InputInterface |
||
| 25 | */ |
||
| 26 | private $input; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * @var OutputInterface |
||
| 30 | */ |
||
| 31 | private $output; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * @var Configuration |
||
| 35 | */ |
||
| 36 | private $configuration; |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @param Application $app |
||
| 40 | * @param InputInterface $input |
||
| 41 | * @param OutputInterface $output |
||
| 42 | * @param Configuration $configuration |
||
| 43 | */ |
||
| 44 | 6 | public function __construct( |
|
| 55 | |||
| 56 | /** |
||
| 57 | * @return string |
||
| 58 | */ |
||
| 59 | 1 | public function getRootDir() |
|
| 63 | |||
| 64 | /** |
||
| 65 | * @param [] $files |
||
|
|
|||
| 66 | * |
||
| 67 | * @return string $path |
||
| 68 | */ |
||
| 69 | 1 | public function generatePhpunitXml(array &$files) |
|
| 101 | |||
| 102 | /** |
||
| 103 | * @param array $files |
||
| 104 | * @param array $env |
||
| 105 | * |
||
| 106 | * @return int $code |
||
| 107 | */ |
||
| 108 | 1 | public function runTestFiles(array $files, array $env = []) |
|
| 126 | |||
| 127 | /** |
||
| 128 | * @param string $command |
||
| 129 | * @param array $env |
||
| 130 | * |
||
| 131 | * @return int |
||
| 132 | */ |
||
| 133 | 1 | View Code Duplication | public function runPhpunit($command, array $env = [], \Closure $callback = null) |
| 143 | |||
| 144 | /** |
||
| 145 | * @param string $command |
||
| 146 | * @param array $env |
||
| 147 | * |
||
| 148 | * @return Process |
||
| 149 | */ |
||
| 150 | View Code Duplication | public function getPhpunitProcess($command, array $env = []) : Process |
|
| 160 | |||
| 161 | /** |
||
| 162 | * @param string $command |
||
| 163 | * @param bool $throw |
||
| 164 | * @param [] $env |
||
| 165 | * |
||
| 166 | * @return int |
||
| 167 | */ |
||
| 168 | 2 | public function run($command, $throw = true, array $env = [], \Closure $callback = null) |
|
| 188 | |||
| 189 | /** |
||
| 190 | * @param string $command |
||
| 191 | */ |
||
| 192 | 2 | public function getProcess($command, array $env = []) : Process |
|
| 204 | |||
| 205 | /** |
||
| 206 | * @param string $command |
||
| 207 | * @param array $input |
||
| 208 | * |
||
| 209 | * @return int |
||
| 210 | */ |
||
| 211 | 1 | public function runTestCommand($command, array $input = []) : int |
|
| 218 | |||
| 219 | /** |
||
| 220 | * @return string |
||
| 221 | */ |
||
| 222 | 1 | private function flags() |
|
| 252 | |||
| 253 | /** |
||
| 254 | * @param string |
||
| 255 | * @param string $command |
||
| 256 | * |
||
| 257 | * @return Process |
||
| 258 | */ |
||
| 259 | protected function createProcess($command) |
||
| 263 | } |
||
| 264 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.