| Total Complexity | 4 |
| Total Lines | 64 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class MakeMigrationCommand extends Command |
||
| 10 | { |
||
| 11 | use HasTablesClassesMap; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * The name and signature of the console command. |
||
| 15 | * |
||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | protected $signature = 'geonames:make:migration |
||
| 19 | {type : Migration type. } |
||
| 20 | {--suffix= : Suffix used for specify country if need. } |
||
| 21 | '; |
||
| 22 | |||
| 23 | /** |
||
| 24 | * The console command description. |
||
| 25 | * |
||
| 26 | * @var string |
||
| 27 | */ |
||
| 28 | protected $description = 'Publish specific migrations.'; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * The filesystem instance. |
||
| 32 | * |
||
| 33 | * @var Filesystem |
||
| 34 | */ |
||
| 35 | protected Filesystem $files; |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Create a new command instance. |
||
| 39 | * |
||
| 40 | * @param Filesystem $files |
||
| 41 | * |
||
| 42 | * @return void |
||
| 43 | */ |
||
| 44 | 18 | public function __construct(Filesystem $files) |
|
| 49 | 18 | } |
|
| 50 | |||
| 51 | 11 | public function handle() |
|
| 52 | { |
||
| 53 | 11 | $tableClassName = $this->getTableClassNameByType($this->argument('type')); |
|
|
|
|||
| 54 | |||
| 55 | 11 | (new $tableClassName($this->files))->makeMigration($this->getSuffix()); |
|
| 56 | |||
| 57 | 11 | return 0; |
|
| 58 | } |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Get formatted suffix. |
||
| 62 | * |
||
| 63 | * @return string|null |
||
| 64 | */ |
||
| 65 | 11 | protected function getSuffix(): ?string |
|
| 73 | } |
||
| 74 | } |
||
| 75 |