| Conditions | 2 |
| Paths | 2 |
| Total Lines | 27 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 13 | public function handle(): void |
||
| 14 | { |
||
| 15 | /** @var string $class */ |
||
| 16 | $class = $this->argument('class'); |
||
| 17 | /** @scrutinizer ignore-type */ |
||
| 18 | $consumerClass = $this->formatClassName($class); |
||
| 19 | |||
| 20 | $consumerPath = $this->getPath($consumerClass); |
||
| 21 | try { |
||
| 22 | $this->ensureValidPaths([ |
||
| 23 | $consumerPath, |
||
| 24 | ]); |
||
| 25 | } catch (MakeFileFailed $exception) { |
||
| 26 | $this->error($exception->getMessage()); |
||
| 27 | } |
||
| 28 | |||
| 29 | $this->makeDirectory($consumerPath); |
||
| 30 | |||
| 31 | $this->makeFiles( |
||
| 32 | ['Consumer' => $consumerPath], |
||
| 33 | [ |
||
| 34 | 'consumer' => class_basename($consumerClass), |
||
| 35 | 'namespace' => substr($consumerClass, 0, strrpos($consumerClass, '\\')), |
||
| 36 | ] |
||
| 37 | ); |
||
| 38 | |||
| 39 | $this->info("{$consumerClass} class created successfully!"); |
||
| 40 | } |
||
| 42 |