ScreenOptions.php
28 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Admin\Preference; |
| 6 | |
| 7 | use AC\Preferences\Preference; |
| 8 | use AC\Preferences\UserFactory; |
| 9 | |
| 10 | class ScreenOptions |
| 11 | { |
| 12 | public function storage(): Preference |
| 13 | { |
| 14 | return (new UserFactory())->create(UserFactory::SCREEN_OPTIONS); |
| 15 | } |
| 16 | |
| 17 | public function is_active(string $option): bool |
| 18 | { |
| 19 | return 1 === $this->storage()->find($option); |
| 20 | } |
| 21 | |
| 22 | public function set_status(string $option, bool $active): void |
| 23 | { |
| 24 | $this->storage()->save($option, (int)$active); |
| 25 | } |
| 26 | |
| 27 | } |
| 28 |