Security update for permissions_by_term
[yaffs-website] / vendor / behat / gherkin / src / Behat / Gherkin / Filter / ComplexFilter.php
1 <?php
2
3 /*
4  * This file is part of the Behat Gherkin.
5  * (c) Konstantin Kudryashov <ever.zet@gmail.com>
6  *
7  * For the full copyright and license information, please view the LICENSE
8  * file that was distributed with this source code.
9  */
10
11 namespace Behat\Gherkin\Filter;
12
13 use Behat\Gherkin\Node\FeatureNode;
14
15 /**
16  * Abstract filter class.
17  *
18  * @author Konstantin Kudryashov <ever.zet@gmail.com>
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 }