EditButton.php
2 days ago
EditorFavorites.php
2 days ago
EditorMenuStatus.php
2 days ago
IntegrationStatus.php
2 days ago
ListColumnOrder.php
2 days ago
ListScreenOrder.php
2 days ago
OriginalColumnsRepository.php
2 days ago
TableListOrder.php
2 days ago
UserColumnOrder.php
2 days 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 | private GeneralOption $storage; |
| 12 | |
| 13 | public function __construct(GeneralOption $storage) |
| 14 | { |
| 15 | $this->storage = $storage; |
| 16 | } |
| 17 | |
| 18 | public function set_active(string $slug): void |
| 19 | { |
| 20 | $this->storage->delete('integration_' . $slug); |
| 21 | } |
| 22 | |
| 23 | public function set_inactive(string $slug): void |
| 24 | { |
| 25 | $this->storage->save('integration_' . $slug, 'inactive'); |
| 26 | } |
| 27 | |
| 28 | public function is_active(string $slug): bool |
| 29 | { |
| 30 | $state = $this->storage->get('integration_' . $slug) ?? null; |
| 31 | |
| 32 | return in_array( |
| 33 | $state, |
| 34 | ['active', null], |
| 35 | true |
| 36 | ); |
| 37 | } |
| 38 | |
| 39 | } |
| 40 |