Total Complexity | 3 |
Total Lines | 21 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
8 | class AdminHelper implements AdminHelperInterface |
||
9 | { |
||
10 | private $frozen = false; |
||
11 | |||
12 | /** |
||
13 | * @var AdminInterface |
||
14 | */ |
||
15 | private $admin; |
||
16 | |||
17 | public function setCurrent(AdminInterface $admin): void |
||
18 | { |
||
19 | if ($this->frozen) { |
||
20 | throw new Exception('The current admin cannot be set twice in a request'); |
||
21 | } |
||
22 | $this->admin = $admin; |
||
23 | $this->frozen = true; |
||
24 | } |
||
25 | |||
26 | public function getCurrent(): ?AdminInterface |
||
29 | } |
||
30 | } |
||
31 |