1 | <?php |
||
7 | class App |
||
8 | { |
||
9 | /** @var int */ |
||
10 | public $id; |
||
11 | |||
12 | /** @var string */ |
||
13 | public $key; |
||
14 | |||
15 | /** @var string */ |
||
16 | public $secret; |
||
17 | |||
18 | /** @var string|null */ |
||
19 | public $name; |
||
20 | |||
21 | /** @var string|null */ |
||
22 | public $host; |
||
23 | |||
24 | /** @var string|null */ |
||
25 | public $path; |
||
26 | |||
27 | /** @var int|null */ |
||
28 | public $capacity = null; |
||
29 | |||
30 | /** @var bool */ |
||
31 | public $clientMessagesEnabled = false; |
||
32 | |||
33 | /** @var bool */ |
||
34 | public $statisticsEnabled = true; |
||
35 | |||
36 | public static function findById($appId) |
||
40 | |||
41 | public static function findByKey(string $appKey): ?self |
||
45 | |||
46 | public static function findBySecret(string $appSecret): ?self |
||
50 | |||
51 | public function __construct($appId, string $appKey, string $appSecret) |
||
67 | |||
68 | public function setName(string $appName) |
||
74 | |||
75 | public function setHost(string $host) |
||
81 | |||
82 | public function setPath(string $path) |
||
83 | { |
||
84 | $this->path = $path; |
||
85 | |||
86 | return $this; |
||
87 | } |
||
88 | |||
89 | public function enableClientMessages(bool $enabled = true) |
||
90 | { |
||
91 | $this->clientMessagesEnabled = $enabled; |
||
92 | |||
93 | return $this; |
||
94 | } |
||
95 | |||
96 | public function setCapacity(?int $capacity) |
||
102 | |||
103 | public function enableStatistics(bool $enabled = true) |
||
109 | } |
||
110 |