1 | <?php |
||
49 | class Reference implements InvokableInterface |
||
50 | { |
||
51 | /** |
||
52 | * Container's reference name |
||
53 | * @var string |
||
54 | */ |
||
55 | protected $name; |
||
56 | |||
57 | /** |
||
58 | * Constructor |
||
59 | * |
||
60 | * @param string $name Container's reference name |
||
61 | * |
||
62 | * @return void |
||
|
|||
63 | */ |
||
64 | 14 | public function __construct($name) |
|
68 | |||
69 | /** |
||
70 | * Gets the container's reference name |
||
71 | * |
||
72 | * @return string |
||
73 | */ |
||
74 | 1 | public function getName() |
|
78 | |||
79 | /** |
||
80 | * Defines the container's reference name |
||
81 | * |
||
82 | * @param string $name Container's reference name |
||
83 | * |
||
84 | * @return Reference |
||
85 | */ |
||
86 | 4 | public function setName($name) |
|
92 | |||
93 | /** |
||
94 | * Return the value of the referenced Definition |
||
95 | * |
||
96 | * @param Container $container The Di Container |
||
97 | * @param null|string $name Name of the current definition (if any) |
||
98 | * |
||
99 | * @return mixed |
||
100 | */ |
||
101 | 10 | public function invoke(Container $container, $name = null) |
|
111 | |||
112 | /** |
||
113 | * Convenience method |
||
114 | * |
||
115 | * @return string |
||
116 | */ |
||
117 | 4 | public function __toString() |
|
121 | } |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.