| Total Complexity | 4 |
| Total Lines | 67 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class LoadDataToDBCommand 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:import:file-to-db |
||
| 19 | {type : Migration type. } |
||
| 20 | {file? : Csv file path. } |
||
| 21 | {--suffix= : Suffix used for specify country if need. } |
||
| 22 | {--truncate : Truncate table before import. } |
||
| 23 | '; |
||
| 24 | |||
| 25 | /** |
||
| 26 | * The console command description. |
||
| 27 | * |
||
| 28 | * @var string |
||
| 29 | */ |
||
| 30 | protected $description = 'Upload data from csv file to DB.'; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * The filesystem instance. |
||
| 34 | * |
||
| 35 | * @var Filesystem |
||
| 36 | */ |
||
| 37 | protected Filesystem $files; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * Create a new command instance. |
||
| 41 | * |
||
| 42 | * @param Filesystem $files |
||
| 43 | * |
||
| 44 | * @return void |
||
| 45 | */ |
||
| 46 | 18 | public function __construct(Filesystem $files) |
|
| 47 | { |
||
| 48 | 18 | parent::__construct(); |
|
| 49 | |||
| 50 | 18 | $this->files = $files; |
|
| 51 | 18 | } |
|
| 52 | |||
| 53 | 11 | public function handle() |
|
| 60 | } |
||
| 61 | |||
| 62 | |||
| 63 | /** |
||
| 64 | * Get formatted suffix. |
||
| 65 | * |
||
| 66 | * @return string|null |
||
| 67 | */ |
||
| 68 | 10 | protected function getSuffix(): ?string |
|
| 78 |