MenuServiceProvider::shareWithApp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace JumpGate\Menu;
4
5
use Illuminate\Foundation\AliasLoader;
6
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
7
8
/**
9
 * Class ServiceProvider
10
 *
11
 * @package JumpGate\Menu
12
 */
13
class MenuServiceProvider extends LaravelServiceProvider
14
{
15
    /**
16
     * Indicates if loading of the provider is deferred.
17
     *
18
     * @var bool
19
     */
20
    protected $defer = false;
21
22
    /**
23
     * Register the service provider.
24
     *
25
     * @return void
26
     */
27
    public function register()
28
    {
29
        $this->shareWithApp();
30
        $this->registerAliases();
31
    }
32
33
    /**
34
     * Share the package with application
35
     *
36
     * @return void
37
     */
38
    protected function shareWithApp()
39
    {
40
        $this->app->singleton('menu', function () {
41
            return new Container();
42
        });
43
    }
44
45
    /**
46
     * Register aliases
47
     *
48
     * @return void
49
     */
50
    protected function registerAliases()
51
    {
52
        $loader = AliasLoader::getInstance();
53
        $loader->alias('Menu', 'JumpGate\Menu\MenuFacade');
54
    }
55
56
    /**
57
     * Get the services provided by the provider.
58
     *
59
     * @return string[]
60
     */
61
    public function provides()
62
    {
63
        return ['menu'];
64
    }
65
66
}
67