1 | <?php |
||
13 | class Modular |
||
14 | { |
||
15 | use Replacer; |
||
16 | use Normalizer; |
||
17 | |||
18 | /** |
||
19 | * @var Application |
||
20 | */ |
||
21 | protected $app; |
||
22 | |||
23 | /** |
||
24 | * @var Collection|null |
||
25 | */ |
||
26 | protected $modules = null; |
||
27 | |||
28 | /** |
||
29 | * @var Config |
||
30 | */ |
||
31 | protected $config; |
||
32 | |||
33 | /** |
||
34 | * Modular constructor. |
||
35 | * |
||
36 | * @param Application $app |
||
37 | * @param Config $config |
||
38 | */ |
||
39 | public function __construct(Application $app, Config $config) |
||
44 | |||
45 | /** |
||
46 | * Runs main seeders for all active modules |
||
47 | * |
||
48 | * @param Seeder $seeder |
||
49 | */ |
||
50 | public function seed(Seeder $seeder) |
||
57 | |||
58 | /** |
||
59 | * Load routes for active modules |
||
60 | * |
||
61 | * @param Registrar $router |
||
62 | * @param string|null $type |
||
63 | */ |
||
64 | public function loadRoutes(Registrar $router, $type = null) |
||
76 | |||
77 | /** |
||
78 | * Load factories for active modules |
||
79 | * |
||
80 | * @param $factory |
||
81 | */ |
||
82 | public function loadFactories($factory) |
||
90 | |||
91 | /** |
||
92 | * Load file |
||
93 | * |
||
94 | * @param string $file |
||
95 | * @param $factory |
||
96 | * |
||
97 | * @codeCoverageIgnore |
||
98 | */ |
||
99 | protected function loadFactoryFile($file, $factory) |
||
103 | |||
104 | /** |
||
105 | * Load service providers for active modules |
||
106 | */ |
||
107 | public function loadServiceProviders() |
||
114 | |||
115 | /** |
||
116 | * Get all routable modules (active and having routes file) |
||
117 | * |
||
118 | * @param string $type |
||
119 | * |
||
120 | * @return array |
||
121 | */ |
||
122 | public function withRoutes($type) |
||
126 | |||
127 | /** |
||
128 | * Get all routable modules (active and having routes file) |
||
129 | * |
||
130 | * @return array |
||
131 | */ |
||
132 | public function withFactories() |
||
136 | |||
137 | /** |
||
138 | * Get all modules that have service providers (active and having service |
||
139 | * provider file) |
||
140 | * |
||
141 | * @return array |
||
142 | */ |
||
143 | public function withServiceProviders() |
||
147 | |||
148 | /** |
||
149 | * Get all modules that have seeders (active and having seeder file) |
||
150 | * |
||
151 | * @return array |
||
152 | */ |
||
153 | public function withSeeders() |
||
157 | |||
158 | /** |
||
159 | * Get active modules that also pass given requirement |
||
160 | * |
||
161 | * @param string $requirement |
||
162 | * |
||
163 | * @param array $data |
||
164 | * |
||
165 | * @return Collection |
||
166 | */ |
||
167 | protected function filterActiveByMethod($requirement, array $data = []) |
||
174 | |||
175 | /** |
||
176 | * Get all modules |
||
177 | * |
||
178 | * @return Collection |
||
179 | */ |
||
180 | public function all() |
||
184 | |||
185 | /** |
||
186 | * Get active modules |
||
187 | * |
||
188 | * @return Collection |
||
189 | */ |
||
190 | public function active() |
||
196 | |||
197 | /** |
||
198 | * Load modules (if not loaded) and get modules |
||
199 | * |
||
200 | * @return Collection |
||
201 | */ |
||
202 | protected function modules() |
||
210 | |||
211 | /** |
||
212 | * Load modules from config |
||
213 | */ |
||
214 | protected function loadModules() |
||
222 | |||
223 | /** |
||
224 | * Find given module by name |
||
225 | * |
||
226 | * @param string $name |
||
227 | * |
||
228 | * @return Module |
||
229 | */ |
||
230 | public function find($name) |
||
237 | |||
238 | /** |
||
239 | * Verify whether module with given name already exists |
||
240 | * |
||
241 | * @param $name |
||
242 | * |
||
243 | * @return bool |
||
244 | */ |
||
245 | public function exists($name) |
||
249 | } |
||
250 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.