1 | <?php |
||
23 | trait ContainerTrait |
||
24 | { |
||
25 | use FactoryTrait; |
||
26 | use ReferenceTrait; |
||
27 | use ConfigAwareTrait; |
||
28 | |||
29 | /** |
||
30 | * delegator for object lookup |
||
31 | * |
||
32 | * @var ContainerInterface |
||
33 | */ |
||
34 | protected $delegator; |
||
35 | |||
36 | /** |
||
37 | * object pool |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | protected $objects; |
||
42 | |||
43 | /** |
||
44 | * @var string[] |
||
45 | */ |
||
46 | protected $classNames = []; |
||
47 | |||
48 | /** |
||
49 | * service definition prefix |
||
50 | * |
||
51 | * @var string |
||
52 | */ |
||
53 | protected $prefix = 'di.service.'; |
||
54 | |||
55 | /** |
||
56 | * common prefix |
||
57 | * |
||
58 | * @var string |
||
59 | */ |
||
60 | protected $common = 'di.common'; |
||
61 | |||
62 | /** |
||
63 | * Reload all service definitions |
||
64 | * |
||
65 | * @return void |
||
66 | */ |
||
67 | protected function reloadAll(): void |
||
79 | |||
80 | /** |
||
81 | * Get the instance |
||
82 | * |
||
83 | * @param string $id |
||
84 | * @return object |
||
85 | */ |
||
86 | protected function getInstance(string $id): object |
||
102 | |||
103 | /** |
||
104 | * creaet a new instance |
||
105 | * |
||
106 | * @param string $id |
||
107 | * @return object |
||
108 | */ |
||
109 | protected function newInstance(string $id): object |
||
116 | |||
117 | /** |
||
118 | * get the raw id as defined in $config |
||
119 | * |
||
120 | * @param string $id |
||
121 | * @return string |
||
122 | */ |
||
123 | protected function getRawId(string $id): string |
||
127 | |||
128 | /** |
||
129 | * execute common methods for newed objects |
||
130 | * |
||
131 | * @param object $object |
||
132 | * @return void |
||
133 | */ |
||
134 | protected function executeCommon(object $object): void |
||
143 | |||
144 | /** |
||
145 | * Try find a service in the definition |
||
146 | * |
||
147 | * @param string $id |
||
148 | * @return bool |
||
149 | */ |
||
150 | protected function hasDefinition(string $id): bool |
||
154 | |||
155 | /** |
||
156 | * @param string $className |
||
157 | * @return object|null |
||
158 | */ |
||
159 | protected function matchClass(string $className): ?object |
||
168 | |||
169 | /** |
||
170 | * {@inheritDoc} |
||
171 | */ |
||
172 | protected function getReference(string $name) |
||
176 | } |