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

DispatcherProvider::register()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 1
rs 9.6666
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