ServiceProvider::provides()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the overtrue/laravel-shopping-cart.
5
 *
6
 * (c) 2016 overtrue <[email protected]>
7
 */
8
9
namespace Overtrue\LaravelShoppingCart;
10
11
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
12
13
/**
14
 * Service provider for Laravel.
15
 */
16
class ServiceProvider extends LaravelServiceProvider
17
{
18
    /**
19
     * Indicates if loading of the provider is deferred.
20
     *
21
     * @var bool
22
     */
23
    protected $defer = true;
24
25
    /**
26
     * Boot the provider.
27
     */
28
    public function boot()
29
    {
30
    }
31
32
    /**
33
     * Register the service provider.
34
     */
35
    public function register()
36
    {
37
        $this->app->singleton(Cart::class, function ($app) {
38
            return new Cart($app['session'], $app['events']);
39
        });
40
41
        $this->app->alias(Cart::class, 'shopping_cart');
42
    }
43
44
    /**
45
     * Get the services provided by the provider.
46
     *
47
     * @return array
48
     */
49
    public function provides()
50
    {
51
        return [Cart::class, 'shopping_cart'];
52
    }
53
}
54