@@ 20-52 (lines=33) @@ | ||
17 | * |
|
18 | * @author Konstantin Kudryashov <[email protected]> |
|
19 | */ |
|
20 | abstract class ComplexFilter implements ComplexFilterInterface |
|
21 | { |
|
22 | /** |
|
23 | * Filters feature according to the filter. |
|
24 | * |
|
25 | * @param FeatureNode $feature |
|
26 | * |
|
27 | * @return FeatureNode |
|
28 | */ |
|
29 | public function filterFeature(FeatureNode $feature) |
|
30 | { |
|
31 | $scenarios = array(); |
|
32 | foreach ($feature->getScenarios() as $scenario) { |
|
33 | if (!$this->isScenarioMatch($feature, $scenario)) { |
|
34 | continue; |
|
35 | } |
|
36 | ||
37 | $scenarios[] = $scenario; |
|
38 | } |
|
39 | ||
40 | return new FeatureNode( |
|
41 | $feature->getTitle(), |
|
42 | $feature->getDescription(), |
|
43 | $feature->getTags(), |
|
44 | $feature->getBackground(), |
|
45 | $scenarios, |
|
46 | $feature->getKeyword(), |
|
47 | $feature->getLanguage(), |
|
48 | $feature->getFile(), |
|
49 | $feature->getLine() |
|
50 | ); |
|
51 | } |
|
52 | } |
|
53 |
@@ 20-56 (lines=37) @@ | ||
17 | * |
|
18 | * @author Konstantin Kudryashov <[email protected]> |
|
19 | */ |
|
20 | abstract class SimpleFilter implements FilterInterface |
|
21 | { |
|
22 | /** |
|
23 | * Filters feature according to the filter. |
|
24 | * |
|
25 | * @param FeatureNode $feature |
|
26 | * |
|
27 | * @return FeatureNode |
|
28 | */ |
|
29 | public function filterFeature(FeatureNode $feature) |
|
30 | { |
|
31 | if ($this->isFeatureMatch($feature)) { |
|
32 | return $feature; |
|
33 | } |
|
34 | ||
35 | $scenarios = array(); |
|
36 | foreach ($feature->getScenarios() as $scenario) { |
|
37 | if (!$this->isScenarioMatch($scenario)) { |
|
38 | continue; |
|
39 | } |
|
40 | ||
41 | $scenarios[] = $scenario; |
|
42 | } |
|
43 | ||
44 | return new FeatureNode( |
|
45 | $feature->getTitle(), |
|
46 | $feature->getDescription(), |
|
47 | $feature->getTags(), |
|
48 | $feature->getBackground(), |
|
49 | $scenarios, |
|
50 | $feature->getKeyword(), |
|
51 | $feature->getLanguage(), |
|
52 | $feature->getFile(), |
|
53 | $feature->getLine() |
|
54 | ); |
|
55 | } |
|
56 | } |
|
57 |