| 1 |
<?php |
| 2 |
|
| 3 |
namespace ReviewX\Utilities\Auth; |
| 4 |
|
| 5 |
\defined("ABSPATH") || exit; |
| 6 |
class ClientManager |
| 7 |
{ |
| 8 |
protected ?object $site = null; |
| 9 |
public function __construct(?object $site) |
| 10 |
{ |
| 11 |
$this->set($site); |
| 12 |
} |
| 13 |
public function set(?object $client) |
| 14 |
{ |
| 15 |
// dd($client); |
| 16 |
$this->site = $client; |
| 17 |
} |
| 18 |
public function has() : bool |
| 19 |
{ |
| 20 |
return $this->site !== null; |
| 21 |
} |
| 22 |
public function site() : ?object |
| 23 |
{ |
| 24 |
return $this->site; |
| 25 |
} |
| 26 |
public function getUid() : string |
| 27 |
{ |
| 28 |
if ($this->has()) { |
| 29 |
return $this->site->uid; |
| 30 |
} |
| 31 |
return ''; |
| 32 |
} |
| 33 |
public function getSiteId() : int |
| 34 |
{ |
| 35 |
if ($this->has()) { |
| 36 |
return $this->site->site_id; |
| 37 |
} |
| 38 |
return 0; |
| 39 |
} |
| 40 |
public function getName() : string |
| 41 |
{ |
| 42 |
if ($this->has()) { |
| 43 |
return $this->site->name; |
| 44 |
} |
| 45 |
return ''; |
| 46 |
} |
| 47 |
public function getDomain() : string |
| 48 |
{ |
| 49 |
if ($this->has()) { |
| 50 |
return $this->site->domain; |
| 51 |
} |
| 52 |
return ''; |
| 53 |
} |
| 54 |
public function getUrl() : string |
| 55 |
{ |
| 56 |
if ($this->has()) { |
| 57 |
return $this->site->url; |
| 58 |
} |
| 59 |
return ''; |
| 60 |
} |
| 61 |
public function getLocale() : string |
| 62 |
{ |
| 63 |
if ($this->has()) { |
| 64 |
return $this->site->locale; |
| 65 |
} |
| 66 |
return ''; |
| 67 |
} |
| 68 |
public function getEmail() : string |
| 69 |
{ |
| 70 |
if ($this->has()) { |
| 71 |
return $this->site->email; |
| 72 |
} |
| 73 |
return ''; |
| 74 |
} |
| 75 |
public function getSecret() : string |
| 76 |
{ |
| 77 |
if ($this->has()) { |
| 78 |
return $this->site->secret; |
| 79 |
} |
| 80 |
return ''; |
| 81 |
} |
| 82 |
public function getSync() : bool |
| 83 |
{ |
| 84 |
if ($this->has()) { |
| 85 |
return (bool) $this->site->is_saas_sync; |
| 86 |
} |
| 87 |
return \false; |
| 88 |
} |
| 89 |
} |
| 90 |
|