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

RouteDispatcherFactory::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1.125

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 4
cp 0.5
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1.125
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
}