*/ class DefinitionNormalizer { /** @var Autowiring */ private $autowiring; public function __construct(Autowiring $autowiring) { $this->autowiring = $autowiring; } /** * Normalize a definition that is *not* nested in another one. * * This is usually a definition declared at the root of a definition array. * * @param mixed $definition * @param string $name The definition name. * @param string[] $wildcardsReplacements Replacements for wildcard definitions. * * @throws InvalidDefinition */ public function normalizeRootDefinition($definition, string $name, array $wildcardsReplacements = null): Definition { if ($definition instanceof DefinitionHelper) { $definition = $definition->getDefinition($name); } elseif (is_array($definition)) { $definition = new ArrayDefinition($definition); } elseif ($definition instanceof \Closure) { $definition = new FactoryDefinition($name, $definition); } elseif (! $definition instanceof Definition) { $definition = new ValueDefinition($definition); } // For a class definition, we replace * in the class name with the matches // *Interface -> *Impl => FooInterface -> FooImpl if ($wildcardsReplacements && $definition instanceof ObjectDefinition) { $definition->replaceWildcards($wildcardsReplacements); } if ($definition instanceof AutowireDefinition) { $definition = $this->autowiring->autowire($name, $definition); } $definition->setName($name); try { $definition->replaceNestedDefinitions([$this, 'normalizeNestedDefinition']); } catch (InvalidDefinition $e) { throw InvalidDefinition::create($definition, sprintf( 'Definition "%s" contains an error: %s', $definition->getName(), $e->getMessage() ), $e); } return $definition; } /** * Normalize a definition that is nested in another one. * * @param mixed $definition * @return mixed * * @throws InvalidDefinition */ public function normalizeNestedDefinition($definition) { $name = ''; if ($definition instanceof DefinitionHelper) { $definition = $definition->getDefinition($name); } elseif (is_array($definition)) { $definition = new ArrayDefinition($definition); } elseif ($definition instanceof \Closure) { $definition = new FactoryDefinition($name, $definition); } if ($definition instanceof DecoratorDefinition) { throw new InvalidDefinition('Decorators cannot be nested in another definition'); } if ($definition instanceof AutowireDefinition) { $definition = $this->autowiring->autowire($name, $definition); } if ($definition instanceof Definition) { $definition->setName($name); // Recursively traverse nested definitions $definition->replaceNestedDefinitions([$this, 'normalizeNestedDefinition']); } return $definition; } } __halt_compiler();----SIGNATURE:----S5hx5q6xtEaTEHtyStnibDG/nXHqDDoKVfBRzLxDWnvOCtqznOlx7BeOdHVNuXErlZxtsZuMcTJIFmhqszRef6Cukk/CDVsdseN1CWcvAKTuyMP2CtYynxg0NzKu18U87JU3oZKBhdaayK6UnMlMBscCQvEepbjBO+TAZUA429AplCDhbMOO+D4g9+iHcukzJ1rNLLgebinhq2Yz6l7NDH8ZknpF9tR5sFHFENOQV36h3qRmx/sEoYn5zQAqPbPUdRPBSgQAxEoaMyXBa8hNo7f9wPvvW4/z23koWcEfJLrZyd9vOzMMStDZjv/X01C8F7++seF4P0/YSsfAwlJGZI0hl71k/hGeKzaJPVwFwdL0iQ0gpQltxjV+GTcRJkKGV9nhPZfsJ404GrkMUc+yIGIVijdQ6VSbkhPTEh3i2j2uf0NN3gPHfmCPMWsEmaLkXTd7DZjIty1137MCB0j66SG6qYaCCyKsSQoU5ldIJhswvI+4GsrVnNF/LJCW7gct3uzF3sZCsFFStv3PtG/Q3PhzMc2k7XTJwmsLRu7CiYkBuNeJdKK2cJ3TlLRD+cjJCZPJE2KBosH8HyV/SQoVs21SFjbfhOCvG6NILouAtIYuyM+8X6L7aiZ1oeuGstWmZeIoYNV6tnS/ch3B9pqOQO7aX25Qu8EXRRgL9xgsaeg=----ATTACHMENT:----MjU3MjE0MTY3NDI0MDM3IDM2MjQ5ODgyMzU0MTM5NjQgODIzMTEyNTEzNjA2NzY3OQ==