| Total Complexity | 10 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Coverage | 48.28% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | class DarkModeManager implements DarkModeManagerInterface { |
||
| 11 | |||
| 12 | private const Key = 'dark_mode.enabled'; |
||
| 13 | |||
| 14 | private $tokenStorage; |
||
| 15 | private $userRepository; |
||
| 16 | |||
| 17 | 7 | public function __construct(TokenStorageInterface $tokenStorage, UserRepositoryInterface $userRepository) { |
|
| 18 | 7 | $this->tokenStorage = $tokenStorage; |
|
| 19 | 7 | $this->userRepository = $userRepository; |
|
| 20 | 7 | } |
|
| 21 | |||
| 22 | 2 | private function getUser(): ?User { |
|
| 23 | 2 | $token = $this->tokenStorage->getToken(); |
|
| 24 | |||
| 25 | 2 | if ($token === null) { |
|
| 26 | return null; |
||
| 27 | } |
||
| 28 | |||
| 29 | 2 | $user = $token->getUser(); |
|
| 30 | |||
| 31 | 2 | if (!$user instanceof User) { |
|
| 32 | return null; |
||
| 33 | } |
||
| 34 | |||
| 35 | 2 | return $user; |
|
| 36 | } |
||
| 37 | |||
| 38 | private function setDarkMode(bool $isDarkModeEnabled): void { |
||
| 44 | } |
||
| 45 | } |
||
| 46 | |||
| 47 | public function enableDarkMode(): void { |
||
| 48 | $this->setDarkMode(true); |
||
| 49 | } |
||
| 50 | |||
| 51 | public function disableDarkMode(): void { |
||
| 53 | } |
||
| 54 | |||
| 55 | 2 | public function isDarkModeEnabled(): bool { |
|
| 63 | } |
||
| 64 | } |