Completed
Pull Request — master (#11)
by ARCANEDEV
03:41
created

NotifyServiceProvider::bindSession()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
crap 1
1
<?php namespace Arcanedev\Notify;
2
3
use Arcanedev\Support\PackageServiceProvider as ServiceProvider;
4
5
/**
6
 * Class     NotifyServiceProvider
7
 *
8
 * @package  Arcanedev\Notify
9
 * @author   ARCANEDEV <[email protected]>
10
 */
11
class NotifyServiceProvider extends ServiceProvider
12
{
13
    /* -----------------------------------------------------------------
14
     |  Properties
15
     | -----------------------------------------------------------------
16
     */
17
18
    /**
19
     * Package name.
20
     *
21
     * @var string
22
     */
23
    protected $package = 'notify';
24
25
    /**
26
     * Indicates if loading of the provider is deferred.
27
     *
28
     * @var bool
29
     */
30
    protected $defer = true;
31
32
    /* -----------------------------------------------------------------
33
     |  Main Methods
34
     | -----------------------------------------------------------------
35
     */
36
37
    /**
38
     * Register the service provider.
39
     */
40 56
    public function register()
41
    {
42 56
        parent::register();
43
44 56
        $this->registerConfig();
45
46
        $this->singleton(StoreManager::class, function ($app) {
47
            return tap(new StoreManager($app), function (StoreManager $manager) {
48 48
                $manager->loadStores();
49 48
            });
50 56
        });
51
52
        $this->bind(Contracts\Store::class, function ($app) {
53 48
            return $app[StoreManager::class]->driver();
54 56
        });
55
56 56
        $this->singleton(Contracts\Notify::class, Notify::class);
57 56
    }
58
59
    /**
60
     * Boot the package.
61
     */
62 56
    public function boot()
63
    {
64 56
        parent::boot();
65
66 56
        $this->publishConfig();
67 56
    }
68
69
    /**
70
     * Get the services provided by the provider.
71
     *
72
     * @return array
73
     */
74 8
    public function provides()
75
    {
76
        return [
77 8
            Contracts\Notify::class,
78
        ];
79
    }
80
}
81