MenuServiceProvider::shareWithApp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

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