Passed
Push — master ( d0f9e3...c3e906 )
by Divine Niiquaye
08:38
created

RouteFactory::createMatcher()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Flight Routing.
7
 *
8
 * PHP version 7.1 and above required
9
 *
10
 * @author    Divine Niiquaye Ibok <[email protected]>
11
 * @copyright 2019 Biurad Group (https://biurad.com/)
12
 * @license   https://opensource.org/licenses/BSD-3-Clause License
13
 *
14
 * For the full copyright and license information, please view the LICENSE
15
 * file that was distributed with this source code.
16
 */
17
18
namespace Flight\Routing;
19
20
use Flight\Routing\Interfaces\RouteCollectionInterface;
21
use Flight\Routing\Interfaces\RouteFactoryInterface;
22
use Flight\Routing\Interfaces\RouteInterface;
23
use Flight\Routing\Interfaces\RouteMatcherInterface;
24
25
class RouteFactory implements RouteFactoryInterface
26
{
27
    /**
28
     * {@inheritDoc}
29
     */
30 43
    public function createCollection(RouteInterface ...$routes): RouteCollectionInterface
31
    {
32 43
        return new RouteCollection(...$routes);
33
    }
34
35
    /**
36
     * {@inheritDoc}
37
     */
38 32
    public function createRoute(string $name, array $methods, string $path, $handler): RouteInterface
39
    {
40 32
        return new Route($name, $methods, $path, $handler);
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46 72
    public function createMatcher(): RouteMatcherInterface
47
    {
48 72
        return new Services\SimpleRouteMatcher();
49
    }
50
}
51