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

RouteFactory   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 24
ccs 6
cts 6
cp 1
rs 10
c 2
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A createCollection() 0 3 1
A createMatcher() 0 3 1
A createRoute() 0 3 1
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