NotifierProvider::register()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 6
c 1
b 0
f 0
dl 0
loc 11
ccs 0
cts 7
cp 0
rs 10
cc 1
nc 1
nop 1
crap 2
1
<?php
2
3
namespace App\Notifier;
4
5
use App\Facades\Log;
6
use App\Facades\Settings;
7
use App\Notifier\Manager;
8
use App\Notifier\SlackAdaptor;
9
use ReflectionClass;
10
use ReflectionException;
11
use Ronanchilvers\Container\Container;
12
use Ronanchilvers\Container\ServiceProviderInterface;
13
use Ronanchilvers\Utility\Str;
14
15
/**
16
 * Provider for notification services
17
 *
18
 * @author Ronan Chilvers <[email protected]>
19
 */
20
class NotifierProvider implements ServiceProviderInterface
21
{
22
    /**
23
     * {@inheritdoc}
24
     *
25
     * @author Ronan Chilvers <[email protected]>
26
     */
27
    public function register(Container $container)
28
    {
29
        $container->share(SlackAdaptor::class, function() {
30
            return new SlackAdaptor();
31
        });
32
33
        $container->share(Manager::class, function($c) {
34
            $manager = new Manager();
35
            $manager->registerAdaptor($c->get(SlackAdaptor::class));
36
37
            return $manager;
38
        });
39
    }
40
}
41