| 1 |
<?php |
| 2 |
|
| 3 |
namespace SyncBasalam\Admin\Settings; |
| 4 |
|
| 5 |
use SyncBasalam\Admin\Settings; |
| 6 |
use SyncBasalam\Admin\Settings\SettingsConfig; |
| 7 |
|
| 8 |
defined('ABSPATH') || exit; |
| 9 |
|
| 10 |
class SettingsContainer |
| 11 |
{ |
| 12 |
private ?array $settings = null; |
| 13 |
|
| 14 |
public function getSettings($setting = null) |
| 15 |
{ |
| 16 |
if ($this->settings === null) { |
| 17 |
$this->settings = Settings::getSettings(); |
| 18 |
} |
| 19 |
|
| 20 |
if ($setting === null) return $this->settings; |
| 21 |
|
| 22 |
return $this->settings[$setting] ?? null; |
| 23 |
} |
| 24 |
|
| 25 |
public function hasToken(): bool |
| 26 |
{ |
| 27 |
$token = ($this->getSettings(SettingsConfig::TOKEN)); |
| 28 |
if (!$token) return false; |
| 29 |
return true; |
| 30 |
} |
| 31 |
} |
| 32 |
|