PluginProbe
Elementor Website Builder – more than just a page builder / 3.30.0-beta1
Elementor Website Builder – more than just a page builder v3.30.0-beta1
4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 All 457 releases
elementor / vendor_prefixed / dependency-injection / php-di / php-di / src / Definition / Reference.php

Reference.php in Elementor Website Builder – more than just a page builder 3.30.0-beta1, at vendor_prefixed/dependency-injection/php-di/php-di/src/Definition/Reference.php

60 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 namespace ElementorDeps\DI\Definition;
5
6 use ElementorDeps\Psr\Container\ContainerInterface;
7 /**
8 * Represents a reference to another entry.
9 *
10 * @author Matthieu Napoli <[email protected]>
11 */
12 class Reference implements Definition, SelfResolvingDefinition
13 {
14 /**
15 * Entry name.
16 * @var string
17 */
18 private $name = '';
19 /**
20 * Name of the target entry.
21 * @var string
22 */
23 private $targetEntryName;
24 /**
25 * @param string $targetEntryName Name of the target entry
26 */
27 public function __construct(string $targetEntryName)
28 {
29 $this->targetEntryName = $targetEntryName;
30 }
31 public function getName() : string
32 {
33 return $this->name;
34 }
35 public function setName(string $name)
36 {
37 $this->name = $name;
38 }
39 public function getTargetEntryName() : string
40 {
41 return $this->targetEntryName;
42 }
43 public function resolve(ContainerInterface $container)
44 {
45 return $container->get($this->getTargetEntryName());
46 }
47 public function isResolvable(ContainerInterface $container) : bool
48 {
49 return $container->has($this->getTargetEntryName());
50 }
51 public function replaceNestedDefinitions(callable $replacer)
52 {
53 // no nested definitions
54 }
55 public function __toString()
56 {
57 return \sprintf('get(%s)', $this->targetEntryName);
58 }
59 }
60