cookiebot
/
addons
/
inc
/
Dependencies
/
DI
/
Definition
/
ObjectDefinition
/
PropertyInjection.php
PropertyInjection.php
57 lines
| 1 | <?php |
| 2 | /** |
| 3 | * PHP-DI |
| 4 | * |
| 5 | * @link http://php-di.org/ |
| 6 | * @copyright Matthieu Napoli (http://mnapoli.fr/) |
| 7 | * @license http://www.opensource.org/licenses/mit-license.php MIT (see the LICENSE file) |
| 8 | */ |
| 9 | |
| 10 | namespace Cybot\Dependencies\DI\Definition\ObjectDefinition; |
| 11 | |
| 12 | /** |
| 13 | * Describe an injection in a class property. |
| 14 | * |
| 15 | * @author Matthieu Napoli <matthieu@mnapoli.fr> |
| 16 | */ |
| 17 | class PropertyInjection |
| 18 | { |
| 19 | /** |
| 20 | * Property name |
| 21 | * @var string |
| 22 | */ |
| 23 | private $propertyName; |
| 24 | |
| 25 | /** |
| 26 | * Value that should be injected in the property |
| 27 | * @var mixed |
| 28 | */ |
| 29 | private $value; |
| 30 | |
| 31 | /** |
| 32 | * @param string $propertyName Property name |
| 33 | * @param mixed $value Value that should be injected in the property |
| 34 | */ |
| 35 | public function __construct($propertyName, $value) |
| 36 | { |
| 37 | $this->propertyName = (string) $propertyName; |
| 38 | $this->value = $value; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * @return string Property name |
| 43 | */ |
| 44 | public function getPropertyName() |
| 45 | { |
| 46 | return $this->propertyName; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * @return string Value that should be injected in the property |
| 51 | */ |
| 52 | public function getValue() |
| 53 | { |
| 54 | return $this->value; |
| 55 | } |
| 56 | } |
| 57 |