elementor
/
vendor_prefixed
/
dependency-injection
/
php-di
/
php-di
/
src
/
Definition
/
ValueDefinition.php
ValueDefinition.php in Elementor Website Builder – more than just a page builder 3.30.0-beta1, at vendor_prefixed/dependency-injection/php-di/php-di/src/Definition/ValueDefinition.php
| 1 | <?php |
| 2 | |
| 3 | declare (strict_types=1); |
| 4 | namespace ElementorDeps\DI\Definition; |
| 5 | |
| 6 | use ElementorDeps\Psr\Container\ContainerInterface; |
| 7 | /** |
| 8 | * Definition of a value for dependency injection. |
| 9 | * |
| 10 | * @author Matthieu Napoli <[email protected]> |
| 11 | */ |
| 12 | class ValueDefinition implements Definition, SelfResolvingDefinition |
| 13 | { |
| 14 | /** |
| 15 | * Entry name. |
| 16 | * @var string |
| 17 | */ |
| 18 | private $name = ''; |
| 19 | /** |
| 20 | * @var mixed |
| 21 | */ |
| 22 | private $value; |
| 23 | /** |
| 24 | * @param mixed $value |
| 25 | */ |
| 26 | public function __construct($value) |
| 27 | { |
| 28 | $this->value = $value; |
| 29 | } |
| 30 | public function getName() : string |
| 31 | { |
| 32 | return $this->name; |
| 33 | } |
| 34 | public function setName(string $name) |
| 35 | { |
| 36 | $this->name = $name; |
| 37 | } |
| 38 | /** |
| 39 | * @return mixed |
| 40 | */ |
| 41 | public function getValue() |
| 42 | { |
| 43 | return $this->value; |
| 44 | } |
| 45 | public function resolve(ContainerInterface $container) |
| 46 | { |
| 47 | return $this->getValue(); |
| 48 | } |
| 49 | public function isResolvable(ContainerInterface $container) : bool |
| 50 | { |
| 51 | return \true; |
| 52 | } |
| 53 | public function replaceNestedDefinitions(callable $replacer) |
| 54 | { |
| 55 | // no nested definitions |
| 56 | } |
| 57 | public function __toString() |
| 58 | { |
| 59 | return \sprintf('Value (%s)', \var_export($this->value, \true)); |
| 60 | } |
| 61 | } |
| 62 |