sugared-rim /
phpunit
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | |||
| 3 | namespace SugaredRim\PHPUnit\TextUI; |
||
| 4 | |||
| 5 | use Schnittstabil\Get\Get; |
||
| 6 | |||
| 7 | View Code Duplication | class Command extends BaseCommand |
|
|
0 ignored issues
–
show
|
|||
| 8 | { |
||
| 9 | /** |
||
| 10 | * {@inheritdoc} |
||
| 11 | * |
||
| 12 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
| 13 | */ |
||
| 14 | public function handleArguments(array $argv): void |
||
| 15 | { |
||
| 16 | parent::handleArguments($argv); |
||
| 17 | |||
| 18 | if (Get::value('sugaredDebug', $this->arguments, false)) { |
||
| 19 | $this->logDebug('Parsed arguments', $this->arguments); |
||
| 20 | } |
||
| 21 | |||
| 22 | $this->addListeners(); |
||
| 23 | } |
||
| 24 | |||
| 25 | /** |
||
| 26 | * {@inheritdoc} |
||
| 27 | * |
||
| 28 | * @SuppressWarnings(PHPMD.BooleanArgumentFlag) |
||
| 29 | */ |
||
| 30 | public function run(array $argv, $exit = true): int |
||
| 31 | { |
||
| 32 | $argv = $this->preprocessArgv($argv); |
||
| 33 | |||
| 34 | if (in_array('--sugared-debug', $argv)) { |
||
| 35 | $this->logDebug('Arguments', $argv); |
||
| 36 | } |
||
| 37 | |||
| 38 | return parent::run($argv, $exit); |
||
| 39 | } |
||
| 40 | } |
||
| 41 |
This check looks for classes that have been defined more than once.
If you can, we would recommend to use standard object-oriented programming techniques. For example, to avoid multiple types, it might make sense to create a common interface, and then multiple, different implementations for that interface.
This also has the side-effect of providing you with better IDE auto-completion, static analysis and also better OPCode caching from PHP.