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

RouteCollection::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 2
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 0
b 0
f 0
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
 * RouteCollection
16
 *
17
 * Use the factory to create this class.
18
 */
19
class RouteCollection implements RouteCollectionInterface
20
{
21
22
    /**
23
     * The collection routes
24
     *
25
     * @var RouteInterface[]
26
     */
27
    private $routes;
28
29
    /**
30
     * Constructor of the class
31
     *
32
     * @param RouteInterface ...$routes
33
     */
34 44
    public function __construct(RouteInterface ...$routes)
35
    {
36 44
        $this->routes = $routes;
37 44
    }
38
39
    /**
40
     * {@inheritDoc}
41
     */
42 33
    public function add(RouteInterface ...$routes) : void
43
    {
44 33
        foreach ($routes as $route) {
45 33
            $this->routes[] = $route;
46
        }
47 33
    }
48
49
    /**
50
     * {@inheritDoc}
51
     */
52 16
    public function all() : array
53
    {
54 16
        return $this->routes;
55
    }
56
}
57