Fixed PHPMD global usage

This commit is contained in:
Florian Bouillon 2019-04-26 10:31:14 +02:00
parent 7414958771
commit e5ae2db418

View File

@ -52,12 +52,13 @@ class ArrayInput extends AbstractInput
public function getValue($name = null) public function getValue($name = null)
{ {
if (!isset($_POST[$this->attributes["name"]]) || empty($_POST[$this->attributes["name"]])) { $post = filter_input_array(INPUT_POST)[$this->attributes["name"]];
if (!isset($post) || empty($post)) {
return array(); return array();
} }
$clas = $this->options["array_type"]; $clas = $this->options["array_type"];
$arr = array(); $arr = array();
foreach ($_POST[$this->attributes["name"]] as $name => $value) { foreach (array_keys($post) as $name) {
$input = new $clas(); $input = new $clas();
$input->setOption("name", $this->attributes["name"]); $input->setOption("name", $this->attributes["name"]);
$arr[] = $input->getValue($name); $arr[] = $input->getValue($name);