StaticTargetRepository   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A add() 0 4 1
A findByRoute() 0 8 2
1
<?php
2
3
namespace Bankiru\Seo\Integration\Local;
4
5
use Bankiru\Seo\TargetDefinitionInterface;
6
use Bankiru\Seo\TargetRepositoryInterface;
7
8
final class StaticTargetRepository implements TargetRepositoryInterface
9
{
10
    /**
11
     * @var TargetDefinitionInterface[][]
12
     */
13
    private $targets = [];
14
15 10
    public function add(TargetDefinitionInterface $target)
16
    {
17 10
        $this->targets[$target->getRoute()][] = $target;
18 10
    }
19
20
    /** {@inheritdoc} */
21 9
    public function findByRoute($route)
22
    {
23 9
        if (!array_key_exists($route, $this->targets)) {
24 2
            return [];
25
        }
26
27 7
        return $this->targets[$route];
28
    }
29
}
30