1 | <?php |
||
12 | class MigrateLaravelCommand extends Command |
||
13 | { |
||
14 | protected $listFileMigrations = [ |
||
15 | 'country' => '_create_table_country', |
||
16 | 'regions' => '_create_table_regions', |
||
17 | 'cities' => '_create_table_cities' |
||
18 | ]; |
||
19 | |||
20 | protected $listFilesSeeder = [ |
||
21 | 'CountryTableSeeder' => 'CountryTableSeeder.php', |
||
22 | 'RegionsTableSeeder' => 'RegionsTableSeeder.php', |
||
23 | 'CitiesTableSeeder' => 'CitiesTableSeeder.php' |
||
24 | ]; |
||
25 | |||
26 | protected $formatterStyle; |
||
27 | protected $progressBar; |
||
28 | |||
29 | 2 | public function __construct(OutputFormatterStyle $formatterStyle, ProgressBar $bar) |
|
36 | |||
37 | 2 | protected function configure() |
|
41 | |||
42 | protected function execute(InputInterface $input, OutputInterface $output) |
||
69 | |||
70 | protected function move(ProgressBar $progress, array $pathList, $fileData) |
||
81 | |||
82 | |||
83 | protected function moveConfig(ProgressBar $progress) |
||
92 | |||
93 | /** |
||
94 | * Just create directory |
||
95 | * @param $dir |
||
96 | */ |
||
97 | protected function createDir($dir) |
||
104 | |||
105 | /** |
||
106 | * Data from stubs file |
||
107 | * @param $nameFile |
||
108 | * @return bool|string |
||
109 | */ |
||
110 | protected function getContent($nameFile) |
||
114 | |||
115 | /** |
||
116 | * Get date normalize mow |
||
117 | * @return mixed |
||
118 | */ |
||
119 | protected function getDateNormalize() |
||
127 | } |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: