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