Passed
Push — master ( 1877a1...37d1bb )
by Gabriel
10:54
created

NotificationServiceProvider::provides()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace ByTIC\Notifications;
4
5
use ByTIC\Notifications\Channels\ChannelInterface;
6
use ByTIC\Notifications\Dispatcher\Dispatcher;
7
use ByTIC\Notifications\Dispatcher\DispatcherInterface;
8
use Nip\Container\ServiceProviders\Providers\AbstractServiceProvider;
9
10
/**
11
 * Class NotificationServiceProvider
12
 * @package ByTIC\Notifications
13
 */
14
class NotificationServiceProvider extends AbstractServiceProvider
15
{
16
17
    /**
18
     * @inheritdoc
19
     */
20
    public function register()
21
    {
22
        $this->registerChannels();
23
        $this->registerDispatcher();
24
    }
25
26
    protected function registerChannels()
27
    {
28
        $manager = new ChannelManager();
29
        $this->getContainer()->share(ChannelInterface::class, $manager);
30
    }
31
32
    protected function registerDispatcher()
33
    {
34
        $dispatcher = new Dispatcher(app(ChannelInterface::class));
35
        $this->getContainer()->share(DispatcherInterface::class, $dispatcher);
36
    }
37
38
    /**
39
     * @inheritdoc
40
     */
41
    public function provides()
42
    {
43
        return [ChannelInterface::class, DispatcherInterface::class];
44
    }
45
}
46