Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Lines | 12 |
Ratio | 100 % |
Tests | 7 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
26 | 12 | public static function forCommand($command, $reason) |
|
27 | { |
||
28 | 12 | $type = is_object($command) ? get_class($command) : gettype($command); |
|
29 | |||
30 | 12 | $exception = new static( |
|
31 | 12 | 'Could not invoke handler for command ' . $type . |
|
32 | 12 | ' for reason: ' . $reason |
|
33 | ); |
||
34 | 12 | $exception->command = $command; |
|
35 | |||
36 | 12 | return $exception; |
|
37 | } |
||
38 | |||
49 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.