Conditions | 5 |
Paths | 5 |
Total Lines | 18 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
13 | public function init($filters = array(), $filterFile = "") |
||
14 | { |
||
15 | if ($filterFile != "") { |
||
16 | if (!file_exists($filterFile)) { |
||
17 | throw new \RuntimeException('Filter file not found: ' . $filterFile); |
||
18 | } |
||
19 | |||
20 | $filterElements = EnvAwareYaml::parse(file_get_contents($filterFile)); |
||
21 | |||
22 | foreach ($filterElements as $rule => $uris) { |
||
|
|||
23 | foreach ($uris as $uri) { |
||
24 | $this->filters[] = array("rule" => $rule, "uri" => $uri); |
||
25 | } |
||
26 | } |
||
27 | } else { |
||
28 | $this->filters = $filters; |
||
29 | } |
||
30 | } |
||
31 | |||
47 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.