CollectionRoute   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
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 30
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
4
namespace PTS\Routing;
5
6
use PTS\Tools\Collection;
7
use PTS\Tools\DuplicateKeyException;
8
9
class CollectionRoute extends Collection
10
{
11
12
    /**
13
     * @param string $name
14
     * @param Route $route
15
     * @param int $priority
16
     *
17
     * @return $this
18
     *
19
     * @throws DuplicateKeyException
20
     */
21 12
    public function add(string $name, Route $route, int $priority = 50): self
22
    {
23 12
        return $this->addItem($name, $route, $priority);
24
    }
25
26 1
    public function remove(string $name): self
27
    {
28 1
        return $this->removeItemWithoutPriority($name);
29
    }
30
31
    /**
32
     * @return Route[]
33
     */
34 11
    public function getRoutes(): array
35
    {
36 11
        return $this->getFlatItems(true);
37
    }
38
}
39