PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 6.1.0
Defender Security – Malware Scanner, Login Security & Firewall v6.1.0
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / lib / packages / DI / Definition / ObjectDefinition / PropertyInjection.php

PropertyInjection.php in Defender Security – Malware Scanner, Login Security & Firewall 6.1.0, at lib/packages/DI/Definition/ObjectDefinition/PropertyInjection.php

62 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace WPMU_DEV\Defender\Vendor\DI\Definition\ObjectDefinition;
6
7 /**
8 * Describe an injection in a class property.
9 *
10 * @author Matthieu Napoli <[email protected]>
11 */
12 class PropertyInjection
13 {
14 private string $propertyName;
15
16 /**
17 * Value that should be injected in the property.
18 */
19 private mixed $value;
20
21 /**
22 * Use for injecting in properties of parent classes: the class name
23 * must be the name of the parent class because private properties
24 * can be attached to the parent classes, not the one we are resolving.
25 */
26 private ?string $className;
27
28 /**
29 * @param string $propertyName Property name
30 * @param mixed $value Value that should be injected in the property
31 */
32 public function __construct(string $propertyName, mixed $value, ?string $className = null)
33 {
34 $this->propertyName = $propertyName;
35 $this->value = $value;
36 $this->className = $className;
37 }
38
39 public function getPropertyName() : string
40 {
41 return $this->propertyName;
42 }
43
44 /**
45 * @return mixed Value that should be injected in the property
46 */
47 public function getValue() : mixed
48 {
49 return $this->value;
50 }
51
52 public function getClassName() : ?string
53 {
54 return $this->className;
55 }
56
57 public function replaceNestedDefinition(callable $replacer) : void
58 {
59 $this->value = $replacer($this->value);
60 }
61 }
62