Passed
Pull Request — master (#34)
by Anatoly
02:23
created

RouteFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 8
c 1
b 0
f 0
dl 0
loc 21
ccs 8
cts 8
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createRoute() 0 15 1
1
<?php declare(strict_types=1);
2
3
/**
4
 * It's free open-source software released under the MIT License.
5
 *
6
 * @author Anatoly Fenric <[email protected]>
7
 * @copyright Copyright (c) 2018, Anatoly Fenric
8
 * @license https://github.com/sunrise-php/http-router/blob/master/LICENSE
9
 * @link https://github.com/sunrise-php/http-router
10
 */
11
12
namespace Sunrise\Http\Router;
13
14
/**
15
 * Import classes
16
 */
17
use Psr\Http\Server\RequestHandlerInterface;
18
19
/**
20
 * RouteFactory
21
 */
22
class RouteFactory implements RouteFactoryInterface
23
{
24
25
    /**
26
     * {@inheritDoc}
27
     */
28 23
    public function createRoute(
29
        string $name,
30
        string $path,
31
        array $methods,
32
        RequestHandlerInterface $requestHandler,
33
        array $middlewares = [],
34
        array $attributes = []
35
    ) : RouteInterface {
36 23
        return new Route(
37 23
            $name,
38 23
            $path,
39 23
            $methods,
40 23
            $requestHandler,
41 23
            $middlewares,
42 23
            $attributes
43
        );
44
    }
45
}
46