1 | <?php |
||
30 | class FakeDriver implements DriverInterface, VerifiesService |
||
31 | { |
||
32 | /** @var bool */ |
||
33 | public $matchesRequest = true; |
||
34 | |||
35 | /** @var bool */ |
||
36 | public $hasMatchingEvent = false; |
||
37 | |||
38 | /** @var \BotMan\BotMan\Messages\Incoming\IncomingMessage[] */ |
||
39 | public $messages = []; |
||
40 | |||
41 | /** @var bool */ |
||
42 | public $isBot = false; |
||
43 | |||
44 | /** @var bool */ |
||
45 | public $isInteractiveMessageReply = false; |
||
46 | |||
47 | /** @var bool */ |
||
48 | public $isConfigured = true; |
||
49 | |||
50 | /** @var array */ |
||
51 | private $botMessages = []; |
||
52 | |||
53 | /** @var bool */ |
||
54 | private $botIsTyping = false; |
||
55 | |||
56 | /** @var string */ |
||
57 | private $driver_name = 'Fake'; |
||
58 | |||
59 | /** @var string */ |
||
60 | private $event_name; |
||
61 | |||
62 | /** @var array */ |
||
63 | private $event_payload; |
||
64 | |||
65 | /** @var string */ |
||
66 | private $user_id = null; |
||
67 | |||
68 | /** @var string */ |
||
69 | private $user_first_name = 'Marcel'; |
||
70 | |||
71 | /** @var string */ |
||
72 | private $user_last_name = 'Pociot'; |
||
73 | |||
74 | /** @var string */ |
||
75 | private $username = 'BotMan'; |
||
76 | |||
77 | /** @var array */ |
||
78 | private $user_info = []; |
||
79 | |||
80 | /** |
||
81 | * @return FakeDriver |
||
82 | */ |
||
83 | public static function create() |
||
87 | |||
88 | /** |
||
89 | * @return FakeDriver |
||
90 | */ |
||
91 | public static function createInactive() |
||
98 | |||
99 | public function matchesRequest() |
||
103 | |||
104 | public function getMessages() |
||
112 | |||
113 | protected function isBot() |
||
117 | |||
118 | public function isConfigured() |
||
122 | |||
123 | public function setUser(array $user_info) |
||
131 | |||
132 | public function getUser(IncomingMessage $matchingMessage) |
||
136 | |||
137 | public function getConversationAnswer(IncomingMessage $message) |
||
144 | |||
145 | public function buildServicePayload($message, $matchingMessage, $additionalParameters = []) |
||
149 | |||
150 | public function sendPayload($payload) |
||
157 | |||
158 | public function setName($name) |
||
162 | |||
163 | public function getName() |
||
167 | |||
168 | public function types(IncomingMessage $matchingMessage) |
||
172 | |||
173 | /** |
||
174 | * Send a typing indicator and wait for the given amount of seconds. |
||
175 | * @param IncomingMessage $matchingMessage |
||
176 | * @param int $seconds |
||
177 | * @return mixed |
||
178 | */ |
||
179 | public function typesAndWaits(IncomingMessage $matchingMessage, int $seconds) |
||
183 | |||
184 | /** |
||
185 | * Returns true if types() has been called. |
||
186 | * |
||
187 | * @return bool |
||
188 | */ |
||
189 | public function isBotTyping() |
||
193 | |||
194 | /** |
||
195 | * @return void |
||
196 | */ |
||
197 | public function setEventName($name) |
||
201 | |||
202 | /** |
||
203 | * @return void |
||
204 | */ |
||
205 | public function setEventPayload($payload) |
||
209 | |||
210 | /** |
||
211 | * @return bool|GenericEvent |
||
212 | */ |
||
213 | public function hasMatchingEvent() |
||
224 | |||
225 | /** |
||
226 | * Returns array of messages from bot. |
||
227 | * |
||
228 | * @return string[]|Question[] |
||
229 | */ |
||
230 | public function getBotMessages() |
||
234 | |||
235 | /** |
||
236 | * Clear received messages from bot. |
||
237 | */ |
||
238 | public function resetBotMessages() |
||
243 | |||
244 | /** |
||
245 | * Tells if the stored conversation callbacks are serialized. |
||
246 | * |
||
247 | * @return bool |
||
248 | */ |
||
249 | public function serializesCallbacks() |
||
253 | |||
254 | public function verifyRequest(Request $request) |
||
260 | } |
||
261 |