Provider   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 17
c 2
b 0
f 0
dl 0
loc 50
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A registerHtmlPackage() 0 10 1
A register() 0 7 1
A boot() 0 13 2
1
<?php
2
3
namespace Spinzar\Menu;
4
5
use Illuminate\Foundation\AliasLoader;
6
use Illuminate\Support\ServiceProvider;
7
8
class Provider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     *
13
     * @return void
14
     */
15
    public function boot()
16
    {
17
        $this->publishes([
18
            __DIR__ . '/Config/menu.php' => config_path('menu.php'),
19
            __DIR__ . '/Resources/views' => base_path('resources/views/vendor/spinzar/menu'),
20
        ], 'menu');
21
22
        $this->app->singleton('menu', function ($app) {
23
            return new Menu($app['view'], $app['config']);
24
        });
25
26
        if (file_exists($file = app_path('Support/menus.php'))) {
27
            require_once($file);
28
        }
29
    }
30
31
    /**
32
     * Register the application services.
33
     *
34
     * @return void
35
     */
36
    public function register()
37
    {
38
        $this->registerHtmlPackage();
39
40
        $this->mergeConfigFrom(__DIR__ . '/Config/menu.php', 'menu');
41
42
        $this->loadViewsFrom(__DIR__ . '/Resources/views', 'menu');
43
    }
44
45
    /**
46
     * Register "iluminate/html" package.
47
     */
48
    private function registerHtmlPackage()
49
    {
50
        $this->app->register('Collective\Html\HtmlServiceProvider');
51
52
        $aliases = [
53
            'HTML' => 'Collective\Html\HtmlFacade',
54
            'Form' => 'Collective\Html\FormFacade',
55
        ];
56
57
        AliasLoader::getInstance($aliases)->register();
58
    }
59
}
60