07ecf9e322779060f13d7a5f13c052da607e1b29
[GitHub/WoltLab/WCF.git] /
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 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 * Use for injecting in properties of parent classes: the class name
33 * must be the name of the parent class because private properties
34 * can be attached to the parent classes, not the one we are resolving.
35 * @var string|null
36 */
37 private $className;
38
39 /**
40 * @param string $propertyName Property name
41 * @param mixed $value Value that should be injected in the property
42 * @param string|null $className
43 */
44 public function __construct($propertyName, $value, $className = null)
45 {
46 $this->propertyName = (string) $propertyName;
47 $this->value = $value;
48 $this->className = $className;
49 }
50
51 /**
52 * @return string Property name
53 */
54 public function getPropertyName()
55 {
56 return $this->propertyName;
57 }
58
59 /**
60 * @return string Value that should be injected in the property
61 */
62 public function getValue()
63 {
64 return $this->value;
65 }
66
67 /**
68 * @return string|null
69 */
70 public function getClassName()
71 {
72 return $this->className;
73 }
74 }