1 | <?php |
||
24 | class Botan |
||
25 | { |
||
26 | /** |
||
27 | * Botan.io API URL |
||
28 | * |
||
29 | * @var string |
||
30 | */ |
||
31 | protected static $api_base_uri = 'https://api.botan.io'; |
||
32 | |||
33 | /** |
||
34 | * Yandex AppMetrica application key |
||
35 | * |
||
36 | * @var string |
||
37 | */ |
||
38 | protected static $token = ''; |
||
39 | |||
40 | /** |
||
41 | * Guzzle Client object |
||
42 | * |
||
43 | * @var \GuzzleHttp\Client |
||
44 | */ |
||
45 | private static $client; |
||
46 | |||
47 | /** |
||
48 | * The actual command that is going to be reported |
||
49 | * |
||
50 | * Set as public to let the developers either: |
||
51 | * - block tracking from inside commands by setting the value to non-existent command |
||
52 | * - override which command is tracked when commands call other commands with executeCommand() |
||
53 | * |
||
54 | * @var string |
||
55 | */ |
||
56 | public static $command = ''; |
||
57 | |||
58 | /** |
||
59 | * Enabled |
||
60 | * |
||
61 | * @var bool |
||
62 | */ |
||
63 | protected static $enabled = false; |
||
64 | |||
65 | /** |
||
66 | * Initialize Botan |
||
67 | * |
||
68 | * @param string $token |
||
69 | * @param array $options |
||
70 | * |
||
71 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
72 | */ |
||
73 | public static function initializeBotan($token, array $options = []) |
||
94 | |||
95 | /** |
||
96 | * Lock function to make sure only the first command is reported (the one user requested) |
||
97 | * |
||
98 | * This is in case commands are calling other commands with executeCommand() |
||
99 | * |
||
100 | * @param string $command |
||
101 | */ |
||
102 | public static function lock($command = '') |
||
108 | |||
109 | /** |
||
110 | * Track function |
||
111 | * |
||
112 | * @param \Longman\TelegramBot\Entities\Update $update |
||
113 | * @param string $command |
||
114 | * |
||
115 | * @return bool|string |
||
116 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
117 | */ |
||
118 | public static function track(Update $update, $command = '') |
||
209 | |||
210 | /** |
||
211 | * Url Shortener function |
||
212 | * |
||
213 | * @param string $url |
||
214 | * @param integer $user_id |
||
215 | * |
||
216 | * @return string |
||
217 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
218 | */ |
||
219 | public static function shortenUrl($url, $user_id) |
||
258 | |||
259 | /** |
||
260 | * Return enabled status |
||
261 | * |
||
262 | * @return bool |
||
263 | */ |
||
264 | 2 | public static function isEnabled() |
|
268 | |||
269 | /** |
||
270 | * Set enabled status |
||
271 | * |
||
272 | * @param $enabled bool |
||
273 | * @return void |
||
274 | */ |
||
275 | public static function setEnabled($enabled) |
||
279 | } |
||
280 |