| Conditions | 3 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | 4 | public function create($className) |
|
| 21 | { |
||
| 22 | 4 | $command = ContainerBagLocator::get()->get($className); |
|
| 23 | 4 | if (!($command instanceof CommandInterface) && !($command instanceof Shell)) { |
|
| 24 | /** @psalm-suppress DeprecatedClass */ |
||
| 25 | 2 | $valid = implode('` or `', [Shell::class, CommandInterface::class]); |
|
| 26 | 2 | $message = sprintf('Class `%s` must be an instance of `%s`.', $className, $valid); |
|
| 27 | 2 | throw new InvalidArgumentException($message); |
|
| 28 | } |
||
| 29 | |||
| 30 | 2 | return $command; |
|
| 31 | } |
||
| 33 |