RouteCollection::add()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
namespace Mosaic\Routing;
4
5
use ArrayIterator;
6
use IteratorAggregate;
7
8
class RouteCollection implements IteratorAggregate
9
{
10
    /**
11
     * @var Route[]
12
     */
13
    protected $routes = [];
14
15
    /**
16
     * @param Route $route
17
     */
18 14
    public function add(Route $route)
19
    {
20 14
        $this->routes[] = $route;
21 14
    }
22
23
    /**
24
     * {@inheritdoc}
25
     * @return Route[]
26
     */
27 13
    public function getIterator()
28
    {
29 13
        return new ArrayIterator($this->routes);
30
    }
31
}
32