Chain::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
namespace Aoe\Asdis\System\Uri\Filter;
3
4
use Aoe\Asdis\System\Uri\Filter\FilterInterface;
5
6
/**
7
 * Chain of filters.
8
 */
9
class Chain extends \ArrayIterator implements FilterInterface
10
{
11
    /**
12
     * Needs to be called due to an extbase bug.
13
     * Hides optional parameters of parent constructor.
14
     */
15 4
    public function __construct()
16
    {
17 4
        parent::__construct();
18 4
    }
19
20
    /**
21
     * @param \Aoe\Asdis\System\Uri\Filter\FilterInterface $filter
22
     */
23 2
    public function append($filter)
24
    {
25 2
        parent::append($filter);
26 2
    }
27
28
    /**
29
     * @param array $paths Array of paths.
30
     * @return array Valid paths.
31
     */
32 2
    public function filter(array $paths)
33
    {
34 2
        if ($this->count() < 1) {
35 1
            return $paths;
36
        }
37 1
        foreach($this as $filter) {
38
            /** @var \Aoe\Asdis\System\Uri\Filter\FilterInterface $filter */
39 1
            $paths = $filter->filter($paths);
40
        }
41 1
        return $paths;
42
    }
43
44
}