1 | <?php |
||
23 | trait ContainerTrait |
||
24 | { |
||
25 | use FactoryTrait; |
||
26 | use ReferenceTrait; |
||
27 | |||
28 | /** |
||
29 | * for configuration lookup |
||
30 | * |
||
31 | * @var ConfigInterface |
||
32 | */ |
||
33 | protected $config; |
||
34 | |||
35 | /** |
||
36 | * delegator for object lookup |
||
37 | * |
||
38 | * @var ContainerInterface |
||
39 | */ |
||
40 | protected $delegator; |
||
41 | |||
42 | /** |
||
43 | * object pool |
||
44 | * |
||
45 | * @var array |
||
46 | */ |
||
47 | protected $objects; |
||
48 | |||
49 | /** |
||
50 | * service prefix |
||
51 | * |
||
52 | * @var string |
||
53 | */ |
||
54 | protected $prefix = 'di.service.'; |
||
55 | |||
56 | /** |
||
57 | * common prefix |
||
58 | * |
||
59 | * @var string |
||
60 | */ |
||
61 | protected $common = 'di.common'; |
||
62 | |||
63 | /** |
||
64 | * Reload all service definitions |
||
65 | * |
||
66 | * @return void |
||
67 | */ |
||
68 | protected function reloadAll(): void |
||
80 | |||
81 | /** |
||
82 | * Get the instance |
||
83 | * |
||
84 | * @param string $id |
||
85 | * @return object |
||
86 | */ |
||
87 | protected function getInstance(string $id): object |
||
100 | |||
101 | /** |
||
102 | * creaet a new instance |
||
103 | * |
||
104 | * @param string $id |
||
105 | * @return object |
||
106 | */ |
||
107 | protected function newInstance(string $id): object |
||
114 | |||
115 | /** |
||
116 | * Try find a service in the definition |
||
117 | * |
||
118 | * @param string $id |
||
119 | * @return bool |
||
120 | */ |
||
121 | protected function hasDefinition(string $id): bool |
||
125 | |||
126 | /** |
||
127 | * get the raw id as defined in $config |
||
128 | * |
||
129 | * @param string $id |
||
130 | * @return string |
||
131 | */ |
||
132 | protected function getRawId(string $id): string |
||
136 | |||
137 | /** |
||
138 | * {@inheritDoc} |
||
139 | */ |
||
140 | protected function getReference(string $name) |
||
144 | |||
145 | /** |
||
146 | * execute common methods for newed objects |
||
147 | * |
||
148 | * @param object $object |
||
149 | * @return void |
||
150 | */ |
||
151 | protected function executeCommon(object $object): void |
||
164 | } |
||
165 |