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) |
||
89 | |||
90 | /** |
||
91 | * Load file |
||
92 | * |
||
93 | * @param string $file |
||
94 | * @param $factory |
||
95 | */ |
||
96 | protected function loadFactoryFile($file, $factory) |
||
100 | |||
101 | /** |
||
102 | * Load service providers for active modules |
||
103 | */ |
||
104 | public function loadServiceProviders() |
||
111 | |||
112 | /** |
||
113 | * Get all routable modules (active and having routes file) |
||
114 | * |
||
115 | * @param string $type |
||
116 | * |
||
117 | * @return array |
||
118 | */ |
||
119 | public function withRoutes($type) |
||
123 | |||
124 | /** |
||
125 | * Get all routable modules (active and having routes file) |
||
126 | * |
||
127 | * @return array |
||
128 | */ |
||
129 | public function withFactories() |
||
133 | |||
134 | /** |
||
135 | * Get all modules that have service providers (active and having service |
||
136 | * provider file) |
||
137 | * |
||
138 | * @return array |
||
139 | */ |
||
140 | public function withServiceProviders() |
||
144 | |||
145 | /** |
||
146 | * Get all modules that have seeders (active and having seeder file) |
||
147 | * |
||
148 | * @return array |
||
149 | */ |
||
150 | public function withSeeders() |
||
154 | |||
155 | /** |
||
156 | * Get active modules that also pass given requirement |
||
157 | * |
||
158 | * @param string $requirement |
||
159 | * |
||
160 | * @param array $data |
||
161 | * |
||
162 | * @return Collection |
||
163 | */ |
||
164 | protected function filterActiveByMethod($requirement, array $data = []) |
||
171 | |||
172 | /** |
||
173 | * Get all modules |
||
174 | * |
||
175 | * @return Collection |
||
176 | */ |
||
177 | public function all() |
||
181 | |||
182 | /** |
||
183 | * Get active modules |
||
184 | * |
||
185 | * @return Collection |
||
186 | */ |
||
187 | public function active() |
||
193 | |||
194 | /** |
||
195 | * Load modules (if not loaded) and get modules |
||
196 | * |
||
197 | * @return Collection |
||
198 | */ |
||
199 | protected function modules() |
||
207 | |||
208 | /** |
||
209 | * Load modules from config |
||
210 | */ |
||
211 | protected function loadModules() |
||
219 | |||
220 | /** |
||
221 | * Find given module by name |
||
222 | * |
||
223 | * @param string $name |
||
224 | * |
||
225 | * @return Module |
||
226 | */ |
||
227 | public function find($name) |
||
234 | |||
235 | /** |
||
236 | * Verify whether module with given name already exists |
||
237 | * |
||
238 | * @param $name |
||
239 | * |
||
240 | * @return bool |
||
241 | */ |
||
242 | public function exists($name) |
||
246 | } |
||
247 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.