1 | <?php |
||
14 | class Thread extends AbstractApi |
||
15 | { |
||
16 | |||
17 | /** |
||
18 | * @var null|\Kerox\Messenger\Api\Thread |
||
19 | */ |
||
20 | private static $_instance; |
||
21 | |||
22 | /** |
||
23 | * ThreadSettings constructor. |
||
24 | * |
||
25 | * @param string $pageToken |
||
26 | * @param \GuzzleHttp\ClientInterface $client |
||
27 | */ |
||
28 | 3 | public function __construct(string $pageToken, ClientInterface $client) |
|
32 | |||
33 | /** |
||
34 | * @param string $pageToken |
||
35 | * @param \GuzzleHttp\ClientInterface $client |
||
36 | * @return \Kerox\Messenger\Api\Thread |
||
37 | */ |
||
38 | 1 | public static function getInstance(string $pageToken, ClientInterface $client): Thread |
|
46 | |||
47 | /** |
||
48 | * @param \Kerox\Messenger\Model\ThreadSettings $threadSettings |
||
49 | * @return \Kerox\Messenger\Response\ThreadResponse |
||
50 | */ |
||
51 | 1 | public function addSetting(ThreadSettings $threadSettings): ThreadResponse |
|
58 | |||
59 | /** |
||
60 | * @param string $type |
||
61 | * @param string $state |
||
62 | * @return void |
||
63 | */ |
||
64 | 1 | public function deleteSetting(string $type, string $state = null) |
|
65 | { |
||
66 | 1 | $this->isValidThreadSettingType($type); |
|
67 | |||
68 | 1 | $threadSettings = new ThreadSettings($type, $state); |
|
69 | |||
70 | $request = new ThreadRequest($this->pageToken, $threadSettings); |
||
71 | $this->client->delete('me/thread_settings', $request->build()); |
||
72 | } |
||
73 | |||
74 | /** |
||
75 | * @param string $threadSettingsType |
||
76 | * @throws \InvalidArgumentException |
||
77 | */ |
||
78 | 1 | private function isValidThreadSettingType(string $threadSettingsType) |
|
79 | { |
||
80 | 1 | $allowedThreadSettingsType = $this->getAllowedThreadSettingsType(); |
|
81 | 1 | if (!in_array($threadSettingsType, $allowedThreadSettingsType)) { |
|
82 | throw new \InvalidArgumentException('$threadSettingsType must be either ' . implode(', '), $allowedThreadSettingsType); |
||
83 | } |
||
84 | 1 | } |
|
85 | |||
86 | /** |
||
87 | * @return array |
||
88 | */ |
||
89 | 1 | private function getAllowedThreadSettingsType(): array |
|
99 | } |
||
100 |
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.