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)
10 namespace DI\Definition\ObjectDefinition;
13 * Describe an injection in a class property.
15 * @author Matthieu Napoli <matthieu@mnapoli.fr>
17 class PropertyInjection
23 private $propertyName;
26 * Value that should be injected in the property
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.
40 * @param string $propertyName Property name
41 * @param mixed $value Value that should be injected in the property
42 * @param string|null $className
44 public function __construct($propertyName, $value, $className = null)
46 $this->propertyName = (string) $propertyName;
47 $this->value = $value;
48 $this->className = $className;
52 * @return string Property name
54 public function getPropertyName()
56 return $this->propertyName;
60 * @return string Value that should be injected in the property
62 public function getValue()
70 public function getClassName()
72 return $this->className;