1 | <?php |
||
21 | class PathsFilter extends SimpleFilter |
||
22 | { |
||
23 | protected $filterPaths = array(); |
||
24 | |||
25 | /** |
||
26 | * Initializes filter. |
||
27 | * |
||
28 | * @param string[] $paths List of approved paths |
||
29 | */ |
||
30 | 3 | public function __construct(array $paths) |
|
31 | { |
||
32 | 3 | $this->filterPaths = array_map( |
|
33 | function ($realpath) { |
||
34 | 3 | return rtrim($realpath, DIRECTORY_SEPARATOR) . |
|
35 | 3 | (is_dir($realpath) ? DIRECTORY_SEPARATOR : ''); |
|
36 | 3 | }, |
|
37 | 3 | array_filter( |
|
38 | 3 | array_map('realpath', $paths) |
|
39 | ) |
||
40 | ); |
||
41 | 3 | } |
|
42 | |||
43 | /** |
||
44 | * Checks if Feature matches specified filter. |
||
45 | * |
||
46 | * @param FeatureNode $feature Feature instance |
||
47 | * |
||
48 | * @return Boolean |
||
49 | */ |
||
50 | 3 | public function isFeatureMatch(FeatureNode $feature) |
|
60 | |||
61 | /** |
||
62 | * Checks if scenario or outline matches specified filter. |
||
63 | * |
||
64 | * @param ScenarioInterface $scenario Scenario or Outline node instance |
||
65 | * |
||
66 | * @return false This filter is designed to work only with features |
||
67 | */ |
||
68 | public function isScenarioMatch(ScenarioInterface $scenario) |
||
72 | } |
||
73 |