1 | <?php |
||
9 | abstract class SuperGlobal implements GlobalInterface |
||
10 | { |
||
11 | /** |
||
12 | * @var Container |
||
13 | */ |
||
14 | private $container; |
||
15 | |||
16 | /** |
||
17 | * @var Security |
||
18 | */ |
||
19 | protected $security; |
||
20 | |||
21 | 8 | public function __construct(Container $container, Security $security) |
|
26 | |||
27 | 2 | public function set(string $key, $value) |
|
28 | { |
||
29 | 2 | $global = $this->getGlobalName(); |
|
30 | 2 | $container = $this->container->get($global); |
|
31 | 2 | $container[$key] = $value; |
|
32 | 2 | $this->container->set($global, $container); |
|
33 | 2 | } |
|
34 | |||
35 | 4 | public function fetch(string $key = null, $default = null) |
|
44 | |||
45 | 1 | public function remove(string $key) |
|
52 | |||
53 | 8 | private function getGlobalName() : string |
|
57 | |||
58 | 1 | private function processRemoval(string $key) |
|
67 | |||
68 | 8 | protected function registerGlobal($value) |
|
73 | } |
||
74 |