Passed
Push — master ( 620416...a29fb4 )
by Rougin
02:02
created

DispatcherProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 11 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 DISPATCHER = 'Zapheus\Routing\DispatcherInterface';
19
20
    /**
21
     * Registers the bindings in the container.
22
     *
23
     * @param  \Zapheus\Container\WritableInterface $container
24
     * @return \Zapheus\Container\ContainerInterface
25
     */
26 9
    public function register(WritableInterface $container)
27
    {
28 9
        $composite = __NAMESPACE__ . '\CompositeRouter';
29
30 9
        $composite = $container->get($composite);
31
32 9
        $dispatcher = new Dispatcher($composite);
33
34 9
        $container->set(self::DISPATCHER, $dispatcher);
35
36 9
        return $container;
37
    }
38
}
39