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 $arguments = []; |
||
35 | |||
36 | /** |
||
37 | * @var array |
||
38 | */ |
||
39 | protected $methods = []; |
||
40 | |||
41 | /** |
||
42 | * @var mixed |
||
43 | */ |
||
44 | protected $resolved; |
||
45 | |||
46 | /** |
||
47 | * Constructor. |
||
48 | * |
||
49 | * @param string $id |
||
50 | * @param mixed $concrete |
||
51 | */ |
||
52 | public function __construct(string $id, $concrete) |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | public function setAlias(string $id): DefinitionInterface |
||
67 | |||
68 | /** |
||
69 | * {@inheritdoc} |
||
70 | */ |
||
71 | public function getAlias(): string |
||
75 | |||
76 | /** |
||
77 | * {@inheritdoc} |
||
78 | */ |
||
79 | public function setShared(bool $shared): DefinitionInterface |
||
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | public function isShared(): bool |
||
93 | |||
94 | /** |
||
95 | * {@inheritdoc} |
||
96 | */ |
||
97 | public function addArgument($arg): DefinitionInterface |
||
103 | |||
104 | /** |
||
105 | * {@inheritdoc} |
||
106 | */ |
||
107 | public function addArguments(array $args): DefinitionInterface |
||
115 | |||
116 | /** |
||
117 | * {@inheritdoc} |
||
118 | */ |
||
119 | public function addMethodCall(string $method, array $args = []): DefinitionInterface |
||
128 | |||
129 | /** |
||
130 | * {@inheritdoc} |
||
131 | */ |
||
132 | public function addMethodCalls(array $methods = []): DefinitionInterface |
||
140 | |||
141 | /** |
||
142 | * {@inheritdoc} |
||
143 | */ |
||
144 | public function resolve(array $args = [], bool $new = false) |
||
178 | |||
179 | /** |
||
180 | * Resolve a callable. |
||
181 | * |
||
182 | * @param callable $concrete |
||
183 | * @param array $args |
||
184 | * |
||
185 | * @return mixed |
||
186 | */ |
||
187 | protected function resolveCallable(callable $concrete, array $args = []) |
||
194 | |||
195 | /** |
||
196 | * Resolve a class. |
||
197 | * |
||
198 | * @param string $concrete |
||
199 | * @param array $args |
||
200 | * |
||
201 | * @return object |
||
202 | */ |
||
203 | protected function resolveClass(string $concrete, array $args = []) |
||
211 | |||
212 | /** |
||
213 | * Invoke methods on resolved instance. |
||
214 | * |
||
215 | * @param object $instance |
||
216 | * |
||
217 | * @return object |
||
218 | */ |
||
219 | protected function invokeMethods($instance) |
||
228 | } |
||
229 |