private function processEvent($container, $listenerId, array $tag, $priority)
{
$definition = $container->getDefinition($listenerId);
if (!$definition->isPublic()) {
throw new \InvalidArgumentException(sprintf('The service "%s" must be public as event listeners are lazy-loaded.', $listenerId));
}
if ($definition->isAbstract()) {
throw new \InvalidArgumentException(sprintf('The service "%s" must not be abstract as event listeners are lazy-loaded.', $listenerId));
}
if (!isset($tag['method'])) {
$tag['method'] = 'on' . preg_replace_callback(['/(?<=\\b)[a-z]/i', '/[^a-z0-9]/i'], function ($matches) {
return strtoupper($matches[0]);
}, $tag['event']);
$tag['method'] = preg_replace('/[^a-z0-9]/i', '', $tag['method']);
}
return ['eventName' => $tag['event'], 'callback' => [$listenerId, $tag['method']], 'priority' => $priority];
}