1 | <?php namespace Modules\Core\Providers; |
||
15 | class CoreServiceProvider extends ServiceProvider |
||
16 | { |
||
17 | /** |
||
18 | * Indicates if loading of the provider is deferred. |
||
19 | * |
||
20 | * @var bool |
||
21 | */ |
||
22 | protected $defer = false; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | protected $prefix = 'asgard'; |
||
28 | |||
29 | /** |
||
30 | * The filters base class name. |
||
31 | * |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $middleware = [ |
||
35 | 'Core' => [ |
||
36 | 'permissions' => 'PermissionMiddleware', |
||
37 | 'auth.admin' => 'AdminMiddleware', |
||
38 | 'public.checkLocale' => 'PublicMiddleware', |
||
39 | 'localizationRedirect' => 'LocalizationMiddleware', |
||
40 | ], |
||
41 | ]; |
||
42 | |||
43 | public function boot(Dispatcher $dispatcher, SidebarManager $manager) |
||
44 | { |
||
45 | $dispatcher->mapUsing(function ($command) { |
||
46 | $command = str_replace('Commands\\', 'Commands\\Handlers\\', get_class($command)); |
||
47 | |||
48 | return trim($command, '\\') . 'Handler@handle'; |
||
49 | }); |
||
50 | |||
51 | $manager->register(AdminSidebar::class); |
||
52 | |||
53 | $this->registerMiddleware($this->app['router']); |
||
54 | $this->registerModuleResourceNamespaces(); |
||
55 | $this->setLocalesConfigurations(); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * Register the service provider. |
||
60 | * |
||
61 | * @return void |
||
62 | */ |
||
63 | public function register() |
||
78 | |||
79 | /** |
||
80 | * Get the services provided by the provider. |
||
81 | * |
||
82 | * @return array |
||
83 | */ |
||
84 | public function provides() |
||
88 | |||
89 | /** |
||
90 | * Register the filters. |
||
91 | * |
||
92 | * @param Router $router |
||
93 | * @return void |
||
94 | */ |
||
95 | public function registerMiddleware(Router $router) |
||
105 | |||
106 | /** |
||
107 | * Register the console commands |
||
108 | */ |
||
109 | private function registerCommands() |
||
121 | |||
122 | /** |
||
123 | * Register the installation command |
||
124 | */ |
||
125 | private function registerInstallCommand() |
||
132 | |||
133 | private function registerThemeCommand() |
||
139 | |||
140 | private function registerPublishModuleAssetsCommand() |
||
146 | |||
147 | private function registerServices() |
||
155 | |||
156 | /** |
||
157 | * Register the modules aliases |
||
158 | */ |
||
159 | private function registerModuleResourceNamespaces() |
||
167 | |||
168 | /** |
||
169 | * Register the view namespaces for the modules |
||
170 | * @param Module $module |
||
171 | */ |
||
172 | protected function registerViewNamespace(Module $module) |
||
182 | |||
183 | /** |
||
184 | * Register the language namespaces for the modules |
||
185 | * @param Module $module |
||
186 | */ |
||
187 | protected function registerLanguageNamespace(Module $module) |
||
203 | |||
204 | /** |
||
205 | * Register the config namespace |
||
206 | * @param Module $module |
||
207 | */ |
||
208 | private function registerConfigNamespace(Module $module) |
||
227 | |||
228 | /** |
||
229 | * @param $file |
||
230 | * @param $package |
||
231 | * @return string |
||
232 | */ |
||
233 | private function getConfigFilename($file, $package) |
||
241 | |||
242 | /** |
||
243 | * Set the locale configuration for |
||
244 | * - laravel localization |
||
245 | * - laravel translatable |
||
246 | */ |
||
247 | private function setLocalesConfigurations() |
||
276 | |||
277 | /** |
||
278 | * @param string $path |
||
279 | * @return bool |
||
280 | */ |
||
281 | private function hasPublishedTranslations($path) |
||
285 | |||
286 | /** |
||
287 | * Does a Module have it's Translations centralised in the Translation module? |
||
288 | * @param Module $module |
||
289 | * @return bool |
||
290 | */ |
||
291 | private function moduleHasCentralisedTranslations(Module $module) |
||
299 | |||
300 | /** |
||
301 | * Get the absolute path to the Centralised Translations for a Module (via the Translations module) |
||
302 | * @param Module $module |
||
303 | * @return string |
||
304 | */ |
||
305 | private function getCentralisedTranslationPath(Module $module) |
||
309 | } |
||
310 | |||
311 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.