Passed
Push — master ( d74cf0...1b179d )
by Rougin
02:10
created

DispatcherProvider   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 21
ccs 5
cts 5
cp 1
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 9
    public function register(WritableInterface $container)
29
    {
30 9
        $collection = $container->get(self::COMPOSITE);
31
32 9
        $dispatcher = new Dispatcher($collection);
33
34 9
        $container->set(self::DISPATCHER, $dispatcher);
35
36 9
        return $container;
37
    }
38
}
39