public function __invoke(ContainerInterface $container, $name, array $options = null)
{
$config = $container->get('config');
if (!isset($config['http_methods_listener'])) {
return new HttpMethodListener();
}
$listenerConfig = $config['http_methods_listener'];
$enabled = array_key_exists('enabled', $listenerConfig) ? $listenerConfig['enabled'] : true;
$allowedMethods = isset($listenerConfig['allowed_methods']) && is_array($listenerConfig['allowed_methods']) ? $listenerConfig['allowed_methods'] : null;
return new HttpMethodListener($enabled, $allowedMethods);
}