InMemoryRedirectSources::named()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 6
rs 10
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