1 | <?php |
||
23 | class LineRangeFilter implements FilterInterface |
||
24 | { |
||
25 | protected $filterMinLine; |
||
26 | protected $filterMaxLine; |
||
27 | |||
28 | /** |
||
29 | * Initializes filter. |
||
30 | * |
||
31 | * @param string $filterMinLine Minimum line of a scenario to filter on |
||
32 | * @param string $filterMaxLine Maximum line of a scenario to filter on |
||
33 | */ |
||
34 | 16 | public function __construct($filterMinLine, $filterMaxLine) |
|
35 | { |
||
36 | 16 | $this->filterMinLine = intval($filterMinLine); |
|
37 | 16 | if ($filterMaxLine == '*') { |
|
38 | 6 | $this->filterMaxLine = PHP_INT_MAX; |
|
39 | 6 | } else { |
|
40 | 10 | $this->filterMaxLine = intval($filterMaxLine); |
|
41 | } |
||
42 | 16 | } |
|
43 | |||
44 | /** |
||
45 | * Checks if Feature matches specified filter. |
||
46 | * |
||
47 | * @param FeatureNode $feature Feature instance |
||
48 | * |
||
49 | * @return Boolean |
||
50 | */ |
||
51 | 5 | public function isFeatureMatch(FeatureNode $feature) |
|
56 | |||
57 | /** |
||
58 | * Checks if scenario or outline matches specified filter. |
||
59 | * |
||
60 | * @param ScenarioInterface $scenario Scenario or Outline node instance |
||
61 | * |
||
62 | * @return Boolean |
||
63 | */ |
||
64 | 11 | public function isScenarioMatch(ScenarioInterface $scenario) |
|
80 | |||
81 | /** |
||
82 | * Filters feature according to the filter. |
||
83 | * |
||
84 | * @param FeatureNode $feature |
||
85 | * |
||
86 | * @return FeatureNode |
||
87 | */ |
||
88 | 2 | public function filterFeature(FeatureNode $feature) |
|
134 | } |
||
135 |