PluginProbe
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot / 4.6.2
BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot v4.6.2
4.9.1 4.9.0 4.8.2 4.8.1 4.8.0 4.7.0 4.6.2 4.6.1 4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 4.5.1 4.5.0 4.4.1 4.4.0 3.3.4 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.5.2 All 199 releases
betterdocs / includes / Dependencies / DI / Definition / ObjectDefinition / PropertyInjection.php

PropertyInjection.php in BetterDocs – AI Documentation, Knowledge Base, MCP Server, Docs, Wikis, FAQ & Chatbot 4.6.2, at includes/Dependencies/DI/Definition/ObjectDefinition/PropertyInjection.php

71 lines 1.5 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 WPDeveloper\BetterDocs\Dependencies\DI\Definition\ObjectDefinition;
6
7 /**
8 * Describe an injection in a class property.
9 *
10 * @author Matthieu Napoli <matthieu@mnapoli.fr>
11 */
12 class PropertyInjection
13 {
14 /**
15 * Property name.
16 * @var string
17 */
18 private $propertyName;
19
20 /**
21 * Value that should be injected in the property.
22 * @var mixed
23 */
24 private $value;
25
26 /**
27 * Use for injecting in properties of parent classes: the class name
28 * must be the name of the parent class because private properties
29 * can be attached to the parent classes, not the one we are resolving.
30 * @var string|null
31 */
32 private $className;
33
34 /**
35 * @param string $propertyName Property name
36 * @param mixed $value Value that should be injected in the property
37 */
38 public function __construct(string $propertyName, $value, ?string $className = null)
39 {
40 $this->propertyName = $propertyName;
41 $this->value = $value;
42 $this->className = $className;
43 }
44
45 public function getPropertyName() : string
46 {
47 return $this->propertyName;
48 }
49
50 /**
51 * @return mixed Value that should be injected in the property
52 */
53 public function getValue()
54 {
55 return $this->value;
56 }
57
58 /**
59 * @return string|null
60 */
61 public function getClassName()
62 {
63 return $this->className;
64 }
65
66 public function replaceNestedDefinition(callable $replacer)
67 {
68 $this->value = $replacer($this->value);
69 }
70 }
71