/** * {@inheritdoc} */ public function get($index) { if (!isset($this->params[$index])) { return null; } /** * @var string $name * @var string $type * @var array $options */ extract($this->params[$index]); foreach (['query', 'request'] as $bag) { $value = $this->request->{$bag}->get($name); if ($value !== null) { if ($type == 'array') { $value = (array) $value; } elseif (strpos($type, '[]') !== false) { $value = (array) $value; $filter = $this->filterManager->get(str_replace('[]', '', $type), $options); array_walk($value, function (&$val) use($filter, $name) { if (is_array($val)) { throw new \RuntimeException(sprintf("Query parameter cannot be a nested array.", $name)); } $val = $filter->filter($val); }); } elseif ($type) { $value = $this->filterManager->get($type, $options)->filter($value); } break; } } return $value; }