Passed
Branch master (ae28f9)
by Alexey
03:28
created

RouteDispatcherFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 62.5%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 27
ccs 5
cts 8
cp 0.625
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A create() 0 4 1
1
<?php declare(strict_types = 1);
2
3
namespace Venta\Routing\Factory;
4
5
use Venta\Contracts\Container\Container;
6
use Venta\Contracts\Routing\Route as RouteContract;
7
use Venta\Contracts\Routing\RouteDispatcher as RouteDispatcherContract;
8
use Venta\Contracts\Routing\RouteDispatcherFactory as RouteDispatcherFactoryContract;
9
use Venta\Routing\RouteDispatcher;
10
11
/**
12
 * Class RouteDispatcherFactory
13
 *
14
 * @package Venta\Routing\Factory
15
 */
16
final class RouteDispatcherFactory implements RouteDispatcherFactoryContract
17
{
18
    /**
19
     * @var Container
20
     */
21
    private $container;
22
23
    /**
24
     * RouteDispatcherFactory constructor.
25
     *
26
     * @param Container $container
27
     */
28 2
    public function __construct(Container $container)
29
    {
30 2
        $this->container = $container;
31 2
    }
32
33
    /**
34
     * @inheritDoc
35
     */
36 1
    public function create(RouteContract $route): RouteDispatcherContract
37
    {
38 1
        return new RouteDispatcher($route, $this->container);
39
    }
40
41
42
}