1 | <?php |
||
11 | class LarouteGeneratorCommand extends Command |
||
12 | { |
||
13 | /** |
||
14 | * The console command name. |
||
15 | * |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $name = 'laroute:generate'; |
||
19 | |||
20 | /** |
||
21 | * The console command description. |
||
22 | * |
||
23 | * @var string |
||
24 | */ |
||
25 | protected $description = 'Generate a laravel routes file'; |
||
26 | |||
27 | /** |
||
28 | * Config. |
||
29 | * |
||
30 | * @var Config |
||
31 | */ |
||
32 | protected $config; |
||
33 | |||
34 | /** |
||
35 | * An array of all the registered routes. |
||
36 | * |
||
37 | * @var \Te7aHoudini\Laroute\Routes\Collection |
||
38 | */ |
||
39 | protected $routes; |
||
40 | |||
41 | /** |
||
42 | * The generator instance. |
||
43 | * |
||
44 | * @var \Te7aHoudini\Laroute\Generators\GeneratorInterface |
||
45 | */ |
||
46 | protected $generator; |
||
47 | |||
48 | /** |
||
49 | * Create a new command instance. |
||
50 | * |
||
51 | * @param Config $config |
||
52 | * @param Routes $routes |
||
53 | * @param Generator $generator |
||
54 | */ |
||
55 | public function __construct(Config $config, Routes $routes, Generator $generator) |
||
63 | |||
64 | /** |
||
65 | * Execute the console command. |
||
66 | * |
||
67 | * @return void |
||
68 | */ |
||
69 | public function handle() |
||
83 | |||
84 | /** |
||
85 | * Get path to the template file. |
||
86 | * |
||
87 | * @return string |
||
88 | */ |
||
89 | protected function getTemplatePath() |
||
93 | |||
94 | /** |
||
95 | * Get the data for the template. |
||
96 | * |
||
97 | * @return array |
||
98 | */ |
||
99 | protected function getTemplateData() |
||
109 | |||
110 | /** |
||
111 | * Get the path where the file will be generated. |
||
112 | * |
||
113 | * @return string |
||
114 | */ |
||
115 | protected function getFileGenerationPath() |
||
122 | |||
123 | /** |
||
124 | * Get an option value either from console input, or the config files. |
||
125 | * |
||
126 | * @param $key |
||
127 | * |
||
128 | * @return array|mixed|string |
||
129 | */ |
||
130 | protected function getOptionOrConfig($key) |
||
138 | |||
139 | /** |
||
140 | * Get the console command options. |
||
141 | * |
||
142 | * @return array |
||
143 | */ |
||
144 | protected function getOptions() |
||
171 | } |
||
172 |