EditButton.php
3 months ago
EditorFavorites.php
3 months ago
EditorMenuStatus.php
3 months ago
IntegrationStatus.php
3 months ago
ListColumnOrder.php
3 months ago
ListScreenOrder.php
3 months ago
OriginalColumnsRepository.php
3 months ago
TableListOrder.php
3 months ago
UserColumnOrder.php
3 months ago
IntegrationStatus.php
40 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AC\Storage\Repository; |
| 6 | |
| 7 | use AC\Settings\GeneralOption; |
| 8 | |
| 9 | class IntegrationStatus |
| 10 | { |
| 11 | |
| 12 | private GeneralOption $storage; |
| 13 | |
| 14 | public function __construct(GeneralOption $storage) |
| 15 | { |
| 16 | $this->storage = $storage; |
| 17 | } |
| 18 | |
| 19 | public function set_active(string $slug): void |
| 20 | { |
| 21 | $this->storage->delete('integration_' . $slug); |
| 22 | } |
| 23 | |
| 24 | public function set_inactive(string $slug): void |
| 25 | { |
| 26 | $this->storage->save('integration_' . $slug, 'inactive'); |
| 27 | } |
| 28 | |
| 29 | public function is_active(string $slug): bool |
| 30 | { |
| 31 | $state = $this->storage->get('integration_' . $slug) ?? null; |
| 32 | |
| 33 | return in_array( |
| 34 | $state, |
| 35 | ['active', null], |
| 36 | true |
| 37 | ); |
| 38 | } |
| 39 | |
| 40 | } |