| 1 | <?php |
||
| 24 | trait ContainerTrait |
||
| 25 | { |
||
| 26 | use FactoryTrait; |
||
| 27 | use ReferenceTrait; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * for configuration lookup |
||
| 31 | * |
||
| 32 | * @var ConfigInterface |
||
| 33 | */ |
||
| 34 | protected $config; |
||
| 35 | |||
| 36 | /** |
||
| 37 | * delegator for object lookup |
||
| 38 | */ |
||
| 39 | protected $delegator; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * object pool |
||
| 43 | * |
||
| 44 | * @var array |
||
| 45 | */ |
||
| 46 | protected $objects = []; |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Get the instance |
||
| 50 | * |
||
| 51 | * @param string $id |
||
| 52 | * @return object |
||
| 53 | */ |
||
| 54 | protected function getInstance(string $id): object |
||
| 61 | |||
| 62 | /** |
||
| 63 | * creaet a new instance |
||
| 64 | * |
||
| 65 | * @param string $id |
||
| 66 | * @return object |
||
| 67 | */ |
||
| 68 | protected function newInstance(string $id, array $args = []): object |
||
| 80 | |||
| 81 | /** |
||
| 82 | * Try find a service in the definition |
||
| 83 | * |
||
| 84 | * @param string $id |
||
| 85 | * @return bool |
||
| 86 | */ |
||
| 87 | protected function hasDefinition(string $id): bool |
||
| 92 | |||
| 93 | /** |
||
| 94 | * {@inheritDoc} |
||
| 95 | */ |
||
| 96 | protected function getReference(string $name) |
||
| 100 | |||
| 101 | /** |
||
| 102 | * from ExtendedContainerTrait |
||
| 103 | */ |
||
| 104 | abstract public function resolve(&$input): void; |
||
| 105 | } |
||
| 106 |