CompositeTokenModifier::modifyAll()   A
last analyzed

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
eloc 3
dl 0
loc 6
c 0
b 0
f 0
rs 10
ccs 4
cts 4
cp 1
cc 2
nc 2
nop 1
crap 2
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 10
    public function addTokenModifier(TokenModifierInterface $tokenModifier)
12
    {
13 10
        $this->tokenModifiers[] = $tokenModifier;
14 10
        return $this;
15
    }
16
17 12
    public function modifyAll(TokenCollection $tokenCollection): TokenCollection
18
    {
19 12
        foreach ($this->tokenModifiers as $tokenModifier) {
20 8
            $tokenCollection = $tokenModifier->modifyAll($tokenCollection);
21
        }
22 12
        return $tokenCollection;
23
    }
24
}
25