Filters   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 5
c 3
b 0
f 1
lcom 1
cbo 1
dl 0
loc 31
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A matches() 0 11 4
1
<?php
2
3
namespace Ionut\Sylar;
4
5
6
use Ionut\Sylar\Filters\FilterReportInterface;
7
8
class Filters
9
{
10
    /**
11
     * @var array
12
     */
13
    protected $items;
14
15
    /**
16
     * @param array $items
17
     */
18
    public function __construct(array $items)
19
    {
20
        $this->items = $items;
21
    }
22
23
    /**
24
     * @param  NormalizedValue  $normalizedValue
25
     * @return Filters\FilterReportInterface[]
26
     */
27
    public function matches(NormalizedValue $normalizedValue)
28
    {
29
        foreach ($this->items as $item) {
30
            foreach ($normalizedValue->getVariantsWithOriginal() as $variant) {
31
                if ($filterReport = $item->matches($variant)) {
32
                    yield $filterReport;
33
                    break;
34
                }
35
            }
36
        }
37
    }
38
}