ChainFactory::getDeclarations()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Aoe\Asdis\System\Uri\Filter;
3
4
use Aoe\Asdis\System\Factory\AbstractDeclarationBasedFactory;
5
use Aoe\Asdis\System\Uri\Filter\Chain;
6
use Aoe\Asdis\System\Uri\Filter\FilterInterface;
7
8
/**
9
 * Factory for filter chains.
10
 */
11
class ChainFactory extends AbstractDeclarationBasedFactory
12
{
13
    /**
14
     * @return \Aoe\Asdis\System\Uri\Filter\Chain
15
     */
16 1
    public function buildChain()
17
    {
18 1
        $this->initialize();
19
        /** @var \Aoe\Asdis\System\Uri\Filter\Chain $chain */
20 1
        $chain = new Chain();
21 1
        foreach ($this->configurationProvider->getFilterKeys() as $filterKey) {
22 1
            $chain->append($this->buildFilter($filterKey));
23
        }
24 1
        return $chain;
25
    }
26
27
    /**
28
     * @return void
29
     */
30 1
    private function initialize()
31
    {
32 1
        $this->setDeclarations($this->getDeclarations());
33 1
        $this->setClassImplements([FilterInterface::class]);
34 1
    }
35
36
    /**
37
     * @param string $filterKey
38
     * @return \Aoe\Asdis\System\Uri\Filter\FilterInterface
39
     */
40 1
    private function buildFilter($filterKey)
41
    {
42 1
        return $this->buildObjectFromKey($filterKey);
43
    }
44
45
    /**
46
     * @return array
47
     */
48
    protected function getDeclarations()
49
    {
50
        return $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['asdis']['filters'];
51
    }
52
}