1 | <?php |
||
19 | class CallbackqueryCommand extends SystemCommand |
||
20 | { |
||
21 | /** |
||
22 | * @var callable[] |
||
23 | */ |
||
24 | protected static $callbacks = []; |
||
25 | |||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $name = 'callbackquery'; |
||
30 | |||
31 | /** |
||
32 | * @var string |
||
33 | */ |
||
34 | protected $description = 'Reply to callback query'; |
||
35 | |||
36 | /** |
||
37 | * @var string |
||
38 | */ |
||
39 | protected $version = '1.0.0'; |
||
40 | |||
41 | /** |
||
42 | * Command execute method |
||
43 | * |
||
44 | * @return mixed |
||
45 | * @throws \Longman\TelegramBot\Exception\TelegramException |
||
46 | */ |
||
47 | public function execute() |
||
48 | { |
||
49 | //$callback_query = $this->getUpdate()->getCallbackQuery(); |
||
1 ignored issue
–
show
|
|||
50 | //$user_id = $callback_query->getFrom()->getId(); |
||
1 ignored issue
–
show
|
|||
51 | //$query_id = $callback_query->getId(); |
||
1 ignored issue
–
show
|
|||
52 | //$query_data = $callback_query->getData(); |
||
1 ignored issue
–
show
|
|||
53 | |||
54 | // Call all registered callbacks. |
||
55 | foreach (self::$callbacks as $callback) { |
||
56 | $callback($this->getUpdate()->getCallbackQuery()); |
||
57 | } |
||
58 | |||
59 | return Request::answerCallbackQuery(['callback_query_id' => $this->getUpdate()->getCallbackQuery()->getId()]); |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * Add a new callback handler for callback queries. |
||
64 | * |
||
65 | * @param $callback |
||
66 | */ |
||
67 | public static function addCallbackHandler($callback) |
||
71 | } |
||
72 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.