1 | <?php |
||
26 | class Container implements ContainerInterface, ReferenceInterface |
||
27 | { |
||
28 | use ContainerTrait; |
||
29 | |||
30 | /** |
||
31 | * @var |
||
32 | */ |
||
33 | protected static $container; |
||
34 | |||
35 | /** |
||
36 | * Constructor |
||
37 | * |
||
38 | * $config is the Phoole\Config\Config object |
||
39 | * $delegator is for lookup delegation. If NULL will use $this |
||
40 | * |
||
41 | * @param ConfigInterface $config |
||
42 | * @param ContainerInterface $delegator |
||
43 | */ |
||
44 | public function __construct( |
||
56 | |||
57 | /** |
||
58 | * Access objects from a static way |
||
59 | * |
||
60 | * @param string $name |
||
61 | * @param array $arguments |
||
62 | * @return object |
||
63 | * @throws LogicException |
||
64 | */ |
||
65 | public static function __callStatic($name, $arguments): object |
||
78 | |||
79 | /** |
||
80 | * |
||
81 | * ```php |
||
82 | * // get the cache object |
||
83 | * $cache = $container->get('cache'); |
||
84 | * |
||
85 | * // get a NEW cache object |
||
86 | * $cacheNew = $container->get('cache@'); |
||
87 | * |
||
88 | * // get an object shared in SESSION scope |
||
89 | * $sessCache = $container->get('cache@SESSION'); |
||
90 | * ``` |
||
91 | * |
||
92 | * {@inheritDoc} |
||
93 | */ |
||
94 | public function get($id): object |
||
102 | |||
103 | /** |
||
104 | * {@inheritDoc} |
||
105 | */ |
||
106 | public function has($id): bool |
||
110 | } |