1 | <?php declare(strict_types=1); |
||
11 | class Definition implements ArgumentResolverInterface, DefinitionInterface |
||
12 | { |
||
13 | use ArgumentResolverTrait; |
||
14 | use ContainerAwareTrait; |
||
15 | |||
16 | /** |
||
17 | * @var string |
||
18 | */ |
||
19 | protected $alias; |
||
20 | |||
21 | /** |
||
22 | * @var mixed |
||
23 | */ |
||
24 | protected $concrete; |
||
25 | |||
26 | /** |
||
27 | * @var boolean |
||
28 | */ |
||
29 | protected $shared = false; |
||
30 | |||
31 | /** |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $tags = []; |
||
35 | |||
36 | /** |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $arguments = []; |
||
40 | |||
41 | /** |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $methods = []; |
||
45 | |||
46 | /** |
||
47 | * @var mixed |
||
48 | */ |
||
49 | protected $resolved; |
||
50 | |||
51 | /** |
||
52 | * Constructor. |
||
53 | * |
||
54 | * @param string $id |
||
55 | * @param mixed $concrete |
||
56 | */ |
||
57 | public function __construct(string $id, $concrete) |
||
62 | |||
63 | /** |
||
64 | * {@inheritdoc} |
||
65 | */ |
||
66 | public function addTag(string $tag): DefinitionInterface |
||
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | public function hasTag(string $tag): bool |
||
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | public function setAlias(string $id): DefinitionInterface |
||
90 | |||
91 | /** |
||
92 | * {@inheritdoc} |
||
93 | */ |
||
94 | public function getAlias(): string |
||
98 | |||
99 | /** |
||
100 | * {@inheritdoc} |
||
101 | */ |
||
102 | public function setShared(bool $shared): DefinitionInterface |
||
108 | |||
109 | /** |
||
110 | * {@inheritdoc} |
||
111 | */ |
||
112 | public function isShared(): bool |
||
116 | |||
117 | /** |
||
118 | * {@inheritdoc} |
||
119 | */ |
||
120 | public function addArgument($arg): DefinitionInterface |
||
126 | |||
127 | /** |
||
128 | * {@inheritdoc} |
||
129 | */ |
||
130 | public function addArguments(array $args): DefinitionInterface |
||
138 | |||
139 | /** |
||
140 | * {@inheritdoc} |
||
141 | */ |
||
142 | public function addMethodCall(string $method, array $args = []): DefinitionInterface |
||
151 | |||
152 | /** |
||
153 | * {@inheritdoc} |
||
154 | */ |
||
155 | public function addMethodCalls(array $methods = []): DefinitionInterface |
||
163 | |||
164 | /** |
||
165 | * {@inheritdoc} |
||
166 | */ |
||
167 | public function resolve(bool $new = false) |
||
201 | |||
202 | /** |
||
203 | * Resolve a callable. |
||
204 | * |
||
205 | * @param callable $concrete |
||
206 | * |
||
207 | * @return mixed |
||
208 | */ |
||
209 | protected function resolveCallable(callable $concrete) |
||
215 | |||
216 | /** |
||
217 | * Resolve a class. |
||
218 | * |
||
219 | * @param string $concrete |
||
220 | * |
||
221 | * @return object |
||
222 | */ |
||
223 | protected function resolveClass(string $concrete) |
||
230 | |||
231 | /** |
||
232 | * Invoke methods on resolved instance. |
||
233 | * |
||
234 | * @param object $instance |
||
235 | * |
||
236 | * @return object |
||
237 | */ |
||
238 | protected function invokeMethods($instance) |
||
247 | } |
||
248 |