1 | <?php |
||
16 | class Container implements ContainerInterface |
||
17 | { |
||
18 | protected $config = []; |
||
19 | |||
20 | /** @var ContainerInterface */ |
||
21 | protected static $instance; |
||
22 | |||
23 | /** @var array raw items */ |
||
24 | protected $raw = []; |
||
25 | |||
26 | /** @var evaluated items */ |
||
27 | protected $build = []; |
||
28 | |||
29 | 30 | public function __construct($config = []) |
|
33 | |||
34 | /** |
||
35 | * Sets instance for static usage |
||
36 | * |
||
37 | * @param ContainerInterface $instance |
||
38 | */ |
||
39 | 27 | public static function setInstance(ContainerInterface $instance) |
|
43 | |||
44 | /** |
||
45 | * Gets instance for static usage |
||
46 | * |
||
47 | * @return ContainerInterface |
||
48 | */ |
||
49 | 53 | public static function getInstance() |
|
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | 55 | public function has($id) |
|
61 | |||
62 | /** |
||
63 | * {@inheritdoc} |
||
64 | */ |
||
65 | 49 | public function get($id) |
|
82 | |||
83 | /** |
||
84 | * Set an object |
||
85 | * |
||
86 | * @param string $id Identifier for the object to set |
||
87 | * @param type $object Object to set |
||
88 | */ |
||
89 | 39 | public function set($id, $object) |
|
96 | |||
97 | /** |
||
98 | * Check object-type matches required type for that ID |
||
99 | * |
||
100 | * @param string $id |
||
101 | * @param mixed $object |
||
102 | * @return void |
||
103 | * @throws \Phile\Exception\ContainerException |
||
104 | */ |
||
105 | 39 | protected function typeCheck($id, $object) |
|
117 | } |
||
118 |