Completed
Push — master ( 216072...caf6f7 )
by Team eFabrica
02:21
created

CompositeTokenModifier::modifyAll()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 6
ccs 4
cts 4
cp 1
crap 2
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Efabrica\TranslationsAutomatization\TokenModifier;
4
5
use Efabrica\TranslationsAutomatization\Tokenizer\TokenCollection;
6
7
class CompositeTokenModifier implements TokenModifierInterface
8
{
9
    private $tokenModifiers = [];
10
11 2
    public function addTokenModifier(TokenModifierInterface $tokenModifier)
12
    {
13 2
        $this->tokenModifiers[] = $tokenModifier;
14 2
        return $this;
15
    }
16
17 2
    public function modifyAll(TokenCollection $tokenCollection): TokenCollection
18
    {
19 2
        foreach ($this->tokenModifiers as $tokenModifier) {
20 2
            $tokenCollection = $tokenModifier->modifyAll($tokenCollection);
21
        }
22 2
        return $tokenCollection;
23
    }
24
}
25