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 / ValueDefinition.php

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

74 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // phpcs:ignoreFile -- Bundled third-party (Mozart) dependency; exempt from plugin coding standards.
3
4 declare(strict_types=1);
5
6 namespace WPDeveloper\BetterDocs\Dependencies\DI\Definition;
7
8 use WPDeveloper\BetterDocs\Dependencies\Psr\Container\ContainerInterface;
9
10 /**
11 * Definition of a value for dependency injection.
12 *
13 * @author Matthieu Napoli <matthieu@mnapoli.fr>
14 */
15 class ValueDefinition implements Definition, SelfResolvingDefinition
16 {
17 /**
18 * Entry name.
19 * @var string
20 */
21 private $name = '';
22
23 /**
24 * @var mixed
25 */
26 private $value;
27
28 /**
29 * @param mixed $value
30 */
31 public function __construct($value)
32 {
33 $this->value = $value;
34 }
35
36 public function getName() : string
37 {
38 return $this->name;
39 }
40
41 public function setName(string $name)
42 {
43 $this->name = $name;
44 }
45
46 /**
47 * @return mixed
48 */
49 public function getValue()
50 {
51 return $this->value;
52 }
53
54 public function resolve(ContainerInterface $container)
55 {
56 return $this->getValue();
57 }
58
59 public function isResolvable(ContainerInterface $container) : bool
60 {
61 return true;
62 }
63
64 public function replaceNestedDefinitions(callable $replacer)
65 {
66 // no nested definitions
67 }
68
69 public function __toString()
70 {
71 return sprintf('Value (%s)', var_export($this->value, true));
72 }
73 }
74