Argument
2 years ago
Attribute
2 years ago
Exception
2 years ago
ParameterBag
3 years ago
Alias.php
4 years ago
ChildDefinition.php
4 years ago
Container.php
2 years ago
ContainerAwareInterface.php
2 years ago
ContainerAwareTrait.php
2 years ago
ContainerBuilder.php
2 years ago
ContainerInterface.php
4 years ago
Definition.php
2 years ago
EnvVarLoaderInterface.php
4 years ago
EnvVarProcessor.php
2 years ago
EnvVarProcessorInterface.php
4 years ago
ExpressionLanguage.php
2 years ago
ExpressionLanguageProvider.php
2 years ago
Parameter.php
4 years ago
Reference.php
4 years ago
ReverseContainer.php
2 years ago
ServiceLocator.php
2 years ago
TaggedContainerInterface.php
4 years ago
TypedReference.php
2 years ago
Variable.php
4 years ago
index.php
3 years ago
ChildDefinition.php
41 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor\Symfony\Component\DependencyInjection; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use MailPoetVendor\Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; |
| 5 | use MailPoetVendor\Symfony\Component\DependencyInjection\Exception\OutOfBoundsException; |
| 6 | class ChildDefinition extends Definition |
| 7 | { |
| 8 | private $parent; |
| 9 | public function __construct(string $parent) |
| 10 | { |
| 11 | $this->parent = $parent; |
| 12 | } |
| 13 | public function getParent() |
| 14 | { |
| 15 | return $this->parent; |
| 16 | } |
| 17 | public function setParent(string $parent) |
| 18 | { |
| 19 | $this->parent = $parent; |
| 20 | return $this; |
| 21 | } |
| 22 | public function getArgument($index) |
| 23 | { |
| 24 | if (\array_key_exists('index_' . $index, $this->arguments)) { |
| 25 | return $this->arguments['index_' . $index]; |
| 26 | } |
| 27 | return parent::getArgument($index); |
| 28 | } |
| 29 | public function replaceArgument($index, $value) |
| 30 | { |
| 31 | if (\is_int($index)) { |
| 32 | $this->arguments['index_' . $index] = $value; |
| 33 | } elseif (\str_starts_with($index, '$')) { |
| 34 | $this->arguments[$index] = $value; |
| 35 | } else { |
| 36 | throw new InvalidArgumentException('The argument must be an existing index or the name of a constructor\'s parameter.'); |
| 37 | } |
| 38 | return $this; |
| 39 | } |
| 40 | } |
| 41 |