Passed
Push — master ( 47699c...d74cf0 )
by Rougin
01:47
created

DispatcherProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 83.33%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 21
ccs 5
cts 6
cp 0.8333
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 9 1
1
<?php
2
3
namespace App\Zapheus;
4
5
use Zapheus\Container\WritableInterface;
6
use Zapheus\Provider\ProviderInterface;
7
use Zapheus\Routing\Dispatcher;
8
use Zapheus\Routing\DispatcherInterface;
9
10
/**
11
 * Dispatcher Provider
12
 *
13
 * @package App
14
 * @author  Rougin Royce Gutib <[email protected]>
15
 */
16
class DispatcherProvider implements ProviderInterface
17
{
18
    const COMPOSITE = 'App\Zapheus\CompositeRouter';
19
20
    const DISPATCHER = 'Zapheus\Routing\DispatcherInterface';
21
22
    /**
23
     * Registers the bindings in the container.
24
     *
25
     * @param  \Zapheus\Container\WritableInterface $container
26
     * @return \Zapheus\Container\ContainerInterface
27
     */
28 6
    public function register(WritableInterface $container)
29
    {
30 6
        $collection = $container->get(self::COMPOSITE);
31
32 6
        $dispatcher = new Dispatcher($collection);
33
34 6
        $container->set(self::DISPATCHER, $dispatcher);
35
36 6
        return $container;
37
    }
38
}
39