*/ 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:----QRotuqZKpFUgOqudjEnEpS8EPFdhLsf4kG2DmSCbrrUi/zmtbLtmQB39CQZVt02e+8KxtaigjmPNgQImmImoImNPPBMBISUhsiU/NH05VjXCRtKFEM4W/qikA1iyB8cIW0c+jkmSAgqOgEOdfSNEujtV273d/VOtwsI+WBe3EGaLwBZtaAcG4je8/v0A+VKKeYgPB2XbT+NLl6rdCWemLCxuwGHG81GxJRO9bWKn2O9sxuCuCJKl6Mhtl8Z/Dh6FOGtss8+l9KsDkntjh5Gid1bxSsGp1VdEgidPMiOVFs5syWL6ZvlAFTt2axbzoE3oypVrqLM0RX0F5luJcmn0VxPkmHVuFQ5Ouav3FYviVkis0R8/tTnV1stUeFxYsrh0tvM+xNp8nTbUoFmmW+CLImZASgB8Ix6PS8Cm99hhD6C1Sy6c/sP1EkHMPUnc9i1VuqonFJ9At/I10Njse7B9D3XyZobAajcwne+7E2nD0RVknVGF+XmCm/AkYQaGvI0rDyNqDdPUoACAYmNU5mf0fQF7gtSXVdmXQ+sqwD5yQ9MPWtkstX3A/I3ssJgLCsoM+7p+oNdTP1DG1eOp+9LFYKgLgvFccYpYBk862Tl1TyMOpRRGkTGn+Wz4srMu+aPxop+EQs/YHA4A6u/prg8GKcgJ9QdzITp6RFWLW61z5tI=----ATTACHMENT:----NTI2NTcyNzIyNDY5MjQxMiA2NDgxNzA5NzI5MDUzODQ5IDE4OTE1MjI5OTc1NzU2OA==