$definitions =
[];
$handlersByBusAndMessage =
[];
$handlerToOriginalServiceIdMapping =
[];
foreach ($container->
findTaggedServiceIds('messenger.message_handler', true
) as $serviceId =>
$tags) { foreach ($tags as $tag) { if (isset($tag['bus'
]) && !\
in_array($tag['bus'
],
$busIds, true
)) { throw new RuntimeException(sprintf('Invalid handler service "%s": bus "%s" specified on the tag "messenger.message_handler" does not exist (known ones are: "%s").',
$serviceId,
$tag['bus'
],
implode('", "',
$busIds)));
} $className =
$this->
getServiceClass($container,
$serviceId);
$r =
$container->
getReflectionClass($className);
if (null ===
$r) { throw new RuntimeException(sprintf('Invalid service "%s": class "%s" does not exist.',
$serviceId,
$className));
} if (isset($tag['handles'
])) { $handles =
isset($tag['method'
]) ?
[$tag['handles'
] =>
$tag['method'
]] :
[$tag['handles'
]];
} else { $handles =
$this->
guessHandledClasses($r,
$serviceId,
$tag['method'
] ?? '__invoke'
);
}