*/ class DefinitionArray implements DefinitionSource, MutableDefinitionSource { const WILDCARD = '*'; /** Matches anything except "\". */ const WILDCARD_PATTERN = '([^\\\\]+)'; /** * DI definitions in a PHP array. * @var array */ private $definitions = []; /** * Cache of wildcard definitions. * @var array|null */ private $wildcardDefinitions; /** @var DefinitionNormalizer */ private $normalizer; public function __construct(array $definitions = [], Autowiring $autowiring = null) { if (isset($definitions[0])) { throw new \Exception('The PHP-DI definition is not indexed by an entry name in the definition array'); } $this->definitions = $definitions; $autowiring = $autowiring ?: new NoAutowiring; $this->normalizer = new DefinitionNormalizer($autowiring); } /** * @param array $definitions DI definitions in a PHP array indexed by the definition name. */ public function addDefinitions(array $definitions) { if (isset($definitions[0])) { throw new \Exception('The PHP-DI definition is not indexed by an entry name in the definition array'); } // The newly added data prevails // "for keys that exist in both arrays, the elements from the left-hand array will be used" $this->definitions = $definitions + $this->definitions; // Clear cache $this->wildcardDefinitions = null; } /** * {@inheritdoc} */ public function addDefinition(Definition $definition) { $this->definitions[$definition->getName()] = $definition; // Clear cache $this->wildcardDefinitions = null; } public function getDefinition(string $name) { // Look for the definition by name if (array_key_exists($name, $this->definitions)) { $definition = $this->definitions[$name]; $definition = $this->normalizer->normalizeRootDefinition($definition, $name); return $definition; } // Build the cache of wildcard definitions if ($this->wildcardDefinitions === null) { $this->wildcardDefinitions = []; foreach ($this->definitions as $key => $definition) { if (strpos($key, self::WILDCARD) !== false) { $this->wildcardDefinitions[$key] = $definition; } } } // Look in wildcards definitions foreach ($this->wildcardDefinitions as $key => $definition) { // Turn the pattern into a regex $key = preg_quote($key); $key = '#' . str_replace('\\' . self::WILDCARD, self::WILDCARD_PATTERN, $key) . '#'; if (preg_match($key, $name, $matches) === 1) { array_shift($matches); $definition = $this->normalizer->normalizeRootDefinition($definition, $name, $matches); return $definition; } } return null; } public function getDefinitions(): array { // Return all definitions except wildcard definitions $definitions = []; foreach ($this->definitions as $key => $definition) { if (strpos($key, self::WILDCARD) === false) { $definitions[$key] = $definition; } } return $definitions; } } __halt_compiler();----SIGNATURE:----dehH7H9AGr0F5jKiRmhkiIVQ38mcirHjj/WuwU+22y7ikE4RCkG+9k5l/yc0+W6jmpm0JQi1Q7vA5lfFzF1ugJAKRHeYYwXzjazkVlYzwASVjic9LVof28l7kjWonRy+zLJU3Zjlu1I01v/n1paQne5ER2rE3Nibgja/klf/bsOETQLI3fYYb0u9d+tD+h8K3kKp5Nj2K080WkzTNW2fQmBt7llvgq15+jdW5gjXrzy5q/ehtfZnjgrP0vtVOtjkK8G2aAGCCRuUosP58Krph4viQxQXuDZ0hJ0LGmkho6IGhZ6+9BBy3ZFllgItKCnDQcoO7KvxkUAUvRLJrW/BcLzBQR5RuKPfhvHDlU7v8npd78MysPZclfZ6lwGpFtTsd5EeQh6QgzXt2apzPkbjXg7352tTGfW6iJhg6/BZBB/KpfUt0++YlRJQXcp56u+MnvHI7cbSu11MBOQvJjv3gVfCZSjYR3WmqiInbWbAFg937AhBPapTjmnCZ56vOQINXeYrNTJ/exlY+iJXZH/p3+LciC4RrKoa9w9DA95FYduHvAebYxRX2R0BYpZKTLsj7H4pG4l4x3cT5tObRmPxddgVZ29t1ZYRKI317pn9o+n40cxG/6sM6stcK91H7otJ0mJ4+vFsPH0EANEG77jfgo8HPSGQHoAUKPGSwjE3+3s=----ATTACHMENT:----NjAzNjMxNzMzMzcwMjMxMSA2NTU2NTI1Njc0NDM4OTkwIDk5MjEwMDIxODU4MTM3ODI=