// replace service container argument of event managers with smaller service locator
// so services can even remain private
foreach($listenerRefsas$connection => $refs){ $this->getEventManagerDef($container, $connection) ->replaceArgument(0, ServiceLocatorTagPass::register($container, $refs)); }
if(!$normalizers = $this->findAndSortTaggedServices('serializer.normalizer', $container)){ thrownewRuntimeException('You must tag at least one service as "serializer.normalizer" to use the "serializer" service.'); }
if(!$encoders = $this->findAndSortTaggedServices('serializer.encoder', $container)){ thrownewRuntimeException('You must tag at least one service as "serializer.encoder" to use the "serializer" service.'); }
continue; } // Resolve constraint validator FQCN even if defined as %foo.validator.class% parameter
$className = $container->getParameterBag()->resolveValue($definition->getClass()); // Extraction of the constraint class name from the Constraint Validator FQCN
$constraintClassNames[] = str_replace('Validator', '', substr(strrchr($className, '\\'), 1)); }
/**
* Determine the manager name.
*
* The default implementation loops over the managerParameters and returns
* the first non-empty parameter.
*
* @throws InvalidArgumentException if none of the managerParameters is found in the container
*/ privatefunctiongetManagerName(ContainerBuilder $container): string { foreach($this->managerParameters as$param){ if($container->hasParameter($param)){ $name = $container->getParameter($param); if($name){ return$name; } } }
thrownewInvalidArgumentException(sprintf('Could not find the manager name parameter in the container. Tried the following parameter names: "%s".', implode('", "', $this->managerParameters))); }
/**
* Determine whether this mapping should be activated or not. This allows
* to take this decision with the container builder available.
*
* This default implementation checks if the class has the enabledParameter
* configured and if so if that parameter is present in the container.
*/
if($public){ $this->assertFalse($container->hasAlias($alias)); }else{ // The alias is replaced by a Definition by the ReplaceAliasByActualDefinitionPass
// in case the original service is private
$this->assertFalse($container->hasDefinition($id)); $this->assertTrue($container->hasDefinition($alias)); }