Passed
Branch master (701f59)
by Alexpts
02:08
created

CollectionRoute   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 21
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 4 1
A remove() 0 4 1
A getRoutes() 0 4 1
1
<?php
2
declare(strict_types = 1);
3
namespace PTS\Routing;
4
5
use PTS\Tools\Collection;
6
7
class CollectionRoute extends Collection
8
{
9
10 11
    public function add(string $name, Route $route, int $priority = 50)
11
    {
12 11
        return $this->addItem($name, $route, $priority);
13
    }
14
15 1
    public function remove(string $name) : CollectionRoute
16
    {
17 1
        return $this->removeItemWithoutPriority($name);
18
    }
19
20
    /**
21
     * @return Route[]
22
     */
23 10
    public function getRoutes() : array
24
    {
25 10
        return $this->getFlatItems(true);
26
    }
27
}
28