firewall/rule parser, better to switch fetchActualRules() to a generator.

This commit is contained in:
Ad Schellevis 2017-12-23 12:45:17 +01:00
parent 6628d7f495
commit 280781b582

View File

@ -158,7 +158,6 @@ class FilterRule extends Rule
*/
private function fetchActualRules()
{
$result = array();
$interfaces = empty($this->rule['interface']) ? array(null) : explode(',', $this->rule['interface']);
foreach ($interfaces as $interface) {
if (isset($this->rule['ipprotocol']) && $this->rule['ipprotocol'] == 'inet46') {
@ -255,10 +254,9 @@ class FilterRule extends Rule
&& isset($tmp['set-prio-low']) && $tmp['set-prio-low'] !== "" ) {
$tmp['set-prio'] = "({$tmp['set-prio']}, {$tmp['set-prio-low']})";
}
$result[] = $tmp;
yield $tmp;
}
}
return $result;
}
/**