InMemoryRedirectSources   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 10
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A named() 0 6 2
1
<?php declare(strict_types=1);
2
3
namespace Stratadox\CardGame\Infrastructure\Test;
4
5
use Stratadox\CardGame\Visiting\RedirectSource;
6
use Stratadox\CardGame\Visiting\RedirectSources;
7
8
final class InMemoryRedirectSources implements RedirectSources
9
{
10
    private $sources = [];
11
12
    public function named(string $name): RedirectSource
13
    {
14
        if (!isset($this->sources[$name])) {
15
            $this->sources[$name] = new RedirectSource($name);
16
        }
17
        return $this->sources[$name];
18
    }
19
}
20