Test Failed
Pull Request — master (#32)
by Anatoly
04:53
created

RouteFactory   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
eloc 8
c 1
b 0
f 0
dl 0
loc 30
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\MiddlewareInterface;
18
use Psr\Http\Server\RequestHandlerInterface;
19
20
/**
21
 * RouteFactory
22
 */
23
class RouteFactory
24
{
25
26
    /**
27
     * Creates a new route from the given parameters
28
     *
29
     * @param string $name
30
     * @param string $path
31
     * @param string[] $methods
32
     * @param RequestHandlerInterface $requestHandler
33
     * @param MiddlewareInterface[] $middlewares
34
     * @param array $attributes
35
     *
36
     * @return RouteInterface
37
     */
38
    public function createRoute(
39
        string $name,
40
        string $path,
41
        array $methods,
42
        RequestHandlerInterface $requestHandler,
43
        array $middlewares = [],
44
        array $attributes = []
45
    ) : RouteInterface {
46
        return new Route(
47
            $name,
48
            $path,
49
            $methods,
50
            $requestHandler,
51
            $middlewares,
52
            $attributes
53
        );
54
    }
55
}
56