FormatterPipeline   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 20
ccs 8
cts 8
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A formatName() 0 8 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Lamoda\MultiEnv\Formatter;
6
7
use Lamoda\MultiEnv\Model\HostId;
8
9
final class FormatterPipeline implements FormatterInterface
10
{
11
    /**
12
     * @var FormatterInterface[]
13
     */
14
    private $formatters;
15
16 2
    public function __construct(array $formatters)
17
    {
18 2
        $this->formatters = $formatters;
19 2
    }
20
21 27
    public function formatName(string $originalName, HostId $hostId): string
22
    {
23 27
        $processResult = $originalName;
24 27
        foreach ($this->formatters as $formatter) {
25 27
            $processResult = $formatter->formatName($processResult, $hostId);
26
        }
27
28 27
        return $processResult;
29
    }
30
}
31