1 | <?php |
||
24 | class DateCommand extends UserCommand |
||
25 | { |
||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $name = 'date'; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $description = 'Show date/time by location'; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $usage = '/date <location>'; |
||
40 | |||
41 | /** |
||
42 | * @var string |
||
43 | */ |
||
44 | protected $version = '1.4.0'; |
||
45 | |||
46 | /** |
||
47 | * Guzzle Client object |
||
48 | * |
||
49 | * @var \GuzzleHttp\Client |
||
50 | */ |
||
51 | private $client; |
||
52 | |||
53 | /** |
||
54 | * Base URI for Google Maps API |
||
55 | * |
||
56 | * @var string |
||
57 | */ |
||
58 | private $google_api_base_uri = 'https://maps.googleapis.com/maps/api/'; |
||
59 | |||
60 | /** |
||
61 | * The Google API Key from the command config |
||
62 | * |
||
63 | * @var string |
||
64 | */ |
||
65 | private $google_api_key; |
||
66 | |||
67 | /** |
||
68 | * Date format |
||
69 | * |
||
70 | * @var string |
||
71 | */ |
||
72 | private $date_format = 'd-m-Y H:i:s'; |
||
73 | |||
74 | /** |
||
75 | * Get coordinates |
||
76 | * |
||
77 | * @param string $location |
||
78 | * |
||
79 | * @return array |
||
80 | */ |
||
81 | private function getCoordinates($location) |
||
110 | |||
111 | /** |
||
112 | * Get date |
||
113 | * |
||
114 | * @param string $lat |
||
115 | * @param string $lng |
||
116 | * |
||
117 | * @return array |
||
118 | */ |
||
119 | private function getDate($lat, $lng) |
||
151 | |||
152 | /** |
||
153 | * Evaluate the response data and see if the request was successful |
||
154 | * |
||
155 | * @param string $data |
||
156 | * |
||
157 | * @return array |
||
158 | */ |
||
159 | private function validateResponseData($data) |
||
176 | |||
177 | /** |
||
178 | * Get formatted date at the passed location |
||
179 | * |
||
180 | * @param string $location |
||
181 | * |
||
182 | * @return string |
||
183 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
184 | */ |
||
185 | private function getFormattedDate($location) |
||
202 | |||
203 | /** |
||
204 | * Command execute method |
||
205 | * |
||
206 | * @return mixed |
||
207 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
208 | */ |
||
209 | public function execute() |
||
235 | } |
||
236 |