1 | <?php |
||
13 | class CommandExtractor |
||
14 | { |
||
15 | private $config; |
||
16 | private $error; |
||
17 | private $messageUtility; |
||
18 | private $dictionary; |
||
19 | private $commandContainer; |
||
20 | |||
21 | /** |
||
22 | * @param string $message |
||
23 | * |
||
24 | * @throws \Exception |
||
25 | * |
||
26 | * @return Command|null|void |
||
27 | */ |
||
28 | 8 | public function getCommandByMessage(string $message) |
|
41 | |||
42 | /** |
||
43 | * @param string $message |
||
44 | * |
||
45 | * @throws \Exception |
||
46 | * |
||
47 | * @return array |
||
48 | */ |
||
49 | 4 | public function countKeywordOccurrence(string $message): array |
|
71 | |||
72 | /** |
||
73 | * @param Command $command |
||
74 | * @param string $message |
||
75 | * |
||
76 | * @return array|void |
||
77 | */ |
||
78 | 4 | private function commandKeywordOccurrence(Command $command, string $message) |
|
91 | |||
92 | /** |
||
93 | * @param string $message |
||
94 | * |
||
95 | * @throws \Exception |
||
96 | * |
||
97 | * @return Command|null |
||
98 | */ |
||
99 | 7 | private function getCommandObjectByMessage(string $message) |
|
114 | |||
115 | /** |
||
116 | * @throws \Exception |
||
117 | * |
||
118 | * @return mixed|void |
||
119 | */ |
||
120 | 3 | private function checkDefaultCommand() |
|
132 | |||
133 | /** |
||
134 | * @param $command |
||
135 | * |
||
136 | * @throws \Exception |
||
137 | * |
||
138 | * @return Command|void |
||
139 | */ |
||
140 | 7 | private function getCommandObjectByCommand($command) |
|
154 | |||
155 | /** |
||
156 | * Validate the command object. |
||
157 | * |
||
158 | * @param Command|null $commandObject |
||
159 | * |
||
160 | * @throws \Exception |
||
161 | * |
||
162 | * @return bool |
||
163 | */ |
||
164 | 5 | private function validateCommandObject($commandObject): bool |
|
177 | |||
178 | /** |
||
179 | * @return string |
||
180 | */ |
||
181 | 4 | public function getError(): string |
|
185 | |||
186 | /** |
||
187 | * @param string $error |
||
188 | */ |
||
189 | 5 | public function setError(string $error) |
|
193 | |||
194 | /** |
||
195 | * @return Config |
||
196 | */ |
||
197 | 4 | public function getConfig(): Config |
|
205 | |||
206 | /** |
||
207 | * @param Config $config |
||
208 | */ |
||
209 | 1 | public function setConfig(Config $config) |
|
213 | |||
214 | /** |
||
215 | * @return MessageUtility |
||
216 | */ |
||
217 | 8 | public function getMessageUtility(): MessageUtility |
|
225 | |||
226 | /** |
||
227 | * @param MessageUtility $messageUtility |
||
228 | */ |
||
229 | 8 | public function setMessageUtility(MessageUtility $messageUtility) |
|
233 | |||
234 | /** |
||
235 | * @return Dictionary |
||
236 | */ |
||
237 | 4 | public function getDictionary(): Dictionary |
|
245 | |||
246 | /** |
||
247 | * @param Dictionary $dictionary |
||
248 | */ |
||
249 | 4 | public function setDictionary(Dictionary $dictionary) |
|
253 | |||
254 | /** |
||
255 | * @return CommandContainer |
||
256 | */ |
||
257 | 8 | public function getCommandContainer(): CommandContainer |
|
265 | |||
266 | /** |
||
267 | * @param CommandContainer $commandContainer |
||
268 | */ |
||
269 | 8 | public function setCommandContainer(CommandContainer $commandContainer) |
|
273 | } |
||
274 |