1 | <?php |
||
19 | class Conversation |
||
20 | { |
||
21 | /** |
||
22 | * All information fetched from the database |
||
23 | * |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $conversation = null; |
||
27 | |||
28 | /** |
||
29 | * Notes stored inside the conversation |
||
30 | * |
||
31 | * @var array |
||
32 | */ |
||
33 | protected $protected_notes = null; |
||
34 | |||
35 | /** |
||
36 | * Notes to be stored |
||
37 | * |
||
38 | * @var array |
||
39 | */ |
||
40 | public $notes = null; |
||
41 | |||
42 | /** |
||
43 | * Telegram user id |
||
44 | * |
||
45 | * @var int |
||
46 | */ |
||
47 | protected $user_id; |
||
48 | |||
49 | /** |
||
50 | * Telegram chat id |
||
51 | * |
||
52 | * @var int |
||
53 | */ |
||
54 | protected $chat_id; |
||
55 | |||
56 | /** |
||
57 | * Command to be executed if the conversation is active |
||
58 | * |
||
59 | * @var string |
||
60 | */ |
||
61 | protected $command; |
||
62 | |||
63 | /** |
||
64 | * Conversation contructor to initialize a new conversation |
||
65 | * |
||
66 | * @param int $user_id |
||
67 | * @param int $chat_id |
||
68 | * @param string $command |
||
69 | */ |
||
70 | 9 | public function __construct($user_id, $chat_id, $command = null) |
|
82 | |||
83 | /** |
||
84 | * Clear all conversation variables. |
||
85 | * |
||
86 | * @return bool Always return true, to allow this method in an if statement. |
||
87 | */ |
||
88 | protected function clear() |
||
96 | |||
97 | /** |
||
98 | * Load the conversation from the database |
||
99 | * |
||
100 | * @return bool |
||
101 | */ |
||
102 | 9 | protected function load() |
|
126 | |||
127 | /** |
||
128 | * Check if the conversation already exists |
||
129 | * |
||
130 | * @return bool |
||
131 | */ |
||
132 | public function exists() |
||
136 | |||
137 | /** |
||
138 | * Start a new conversation if the current command doesn't have one yet |
||
139 | * |
||
140 | * @return bool |
||
141 | */ |
||
142 | protected function start() |
||
157 | |||
158 | /** |
||
159 | * Delete the current conversation |
||
160 | * |
||
161 | * Currently the Conversation is not deleted but just set to 'stopped' |
||
162 | * |
||
163 | * @return bool |
||
164 | */ |
||
165 | public function stop() |
||
169 | |||
170 | /** |
||
171 | * Cancel the current conversation |
||
172 | * |
||
173 | * @return bool |
||
174 | */ |
||
175 | public function cancel() |
||
179 | |||
180 | /** |
||
181 | * Update the status of the current conversation |
||
182 | * |
||
183 | * @param string $status |
||
184 | * |
||
185 | * @return bool |
||
186 | */ |
||
187 | protected function updateStatus($status) |
||
204 | |||
205 | /** |
||
206 | * Store the array/variable in the database with json_encode() function |
||
207 | * |
||
208 | * @return bool |
||
209 | */ |
||
210 | public function update() |
||
223 | |||
224 | /** |
||
225 | * Retrieve the command to execute from the conversation |
||
226 | * |
||
227 | * @return string|null |
||
228 | */ |
||
229 | public function getCommand() |
||
233 | } |
||
234 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..