Enums
11 months ago
ApiConnection.php
11 months ago
MemberLevel.php
11 months ago
MemberSection.php
11 months ago
Membership.php
11 months ago
MembershipChange.php
11 months ago
Page.php
11 months ago
Settings.php
11 months ago
User.php
11 months ago
Settings.php
62 lines
| 1 | <?php |
| 2 | |
| 3 | namespace FapiMember\Model; |
| 4 | |
| 5 | use FapiMember\Model\Enums\Keys\SettingsKey; |
| 6 | use FapiMember\Library\SmartEmailing\Types\IntType; |
| 7 | |
| 8 | class Settings |
| 9 | { |
| 10 | private int|null $timeLockedPageId; |
| 11 | private int|null $loginPageId; |
| 12 | private int|null $dashboardPageId; |
| 13 | |
| 14 | public function __construct(array $data) |
| 15 | { |
| 16 | $this->timeLockedPageId = IntType::extractOrNull($data, SettingsKey::TIME_LOCKED_PAGE); |
| 17 | $this->loginPageId = IntType::extractOrNull($data, SettingsKey::LOGIN_PAGE); |
| 18 | $this->dashboardPageId = IntType::extractOrNull($data, SettingsKey::DASHBOARD_PAGE); |
| 19 | } |
| 20 | |
| 21 | public function getTimeLockedPageId(): int|null |
| 22 | { |
| 23 | return $this->timeLockedPageId; |
| 24 | } |
| 25 | |
| 26 | public function getLoginPageId(): int|null |
| 27 | { |
| 28 | return $this->loginPageId; |
| 29 | } |
| 30 | |
| 31 | public function getDashboardPageId(): int|null |
| 32 | { |
| 33 | return $this->dashboardPageId; |
| 34 | } |
| 35 | |
| 36 | public function setTimeLockedPageId(int|null $timeLockedPageId): void |
| 37 | { |
| 38 | $this->timeLockedPageId = $timeLockedPageId; |
| 39 | } |
| 40 | |
| 41 | public function setLoginPageId(int|null $loginPageId): void |
| 42 | { |
| 43 | $this->loginPageId = $loginPageId; |
| 44 | } |
| 45 | |
| 46 | public function setDashboardPageId(int|null $dashboardPageId): void |
| 47 | { |
| 48 | $this->dashboardPageId = $dashboardPageId; |
| 49 | } |
| 50 | |
| 51 | /** @return array<string> */ |
| 52 | public function toArray(): array |
| 53 | { |
| 54 | return [ |
| 55 | SettingsKey::TIME_LOCKED_PAGE => $this->timeLockedPageId, |
| 56 | SettingsKey::LOGIN_PAGE => $this->loginPageId, |
| 57 | SettingsKey::DASHBOARD_PAGE => $this->dashboardPageId, |
| 58 | ]; |
| 59 | } |
| 60 | |
| 61 | } |
| 62 |