| @@ -14,14 +14,10 @@ | ||
| 14 | 14 | |
| 15 | 15 | public function getValueSanitizer(): callable |
| 16 | 16 | { |
| 17 | 17 | return function ($value) { |
| 18 | - $ips = []; | |
| 19 | - | |
| 20 | - if (! is_array($value)) { | |
| 21 | - $ips = explode("\n", $value); | |
| 22 | - } | |
| 23 | - | |
| 18 | + $ips = is_array($value) ? $value : (is_string($value) ? explode("\n", $value) : []); | |
| 19 | + $ips = array_filter($ips, 'is_string'); | |
| 24 | 20 | $ips = array_map('trim', $ips); |
| 25 | 21 | $ips = array_filter($ips, function ($ip) { |
| 26 | 22 | return filter_var($ip, FILTER_VALIDATE_IP) !== false; |
| 27 | 23 | }); |