1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace TgBotApi\BotApiBase\Traits; |
6
|
|
|
|
7
|
|
|
use TgBotApi\BotApiBase\Exception\ResponseException; |
8
|
|
|
use TgBotApi\BotApiBase\Method\AnswerCallbackQueryMethod; |
9
|
|
|
use TgBotApi\BotApiBase\Method\AnswerInlineQueryMethod; |
10
|
|
|
use TgBotApi\BotApiBase\Method\AnswerPreCheckoutQueryMethod; |
11
|
|
|
use TgBotApi\BotApiBase\Method\AnswerShippingQueryMethod; |
12
|
|
|
use TgBotApi\BotApiBase\Method\Interfaces\AnswerMethodAliasInterface; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Trait AnswerMethodTrait. |
16
|
|
|
*/ |
17
|
|
|
trait AnswerMethodTrait |
18
|
|
|
{ |
19
|
|
|
/** |
20
|
|
|
* @param AnswerMethodAliasInterface $method |
21
|
|
|
* |
22
|
|
|
* @throws ResponseException |
23
|
|
|
* |
24
|
|
|
* @return bool |
25
|
|
|
*/ |
26
|
|
|
abstract public function answer(AnswerMethodAliasInterface $method): bool; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @param AnswerCallbackQueryMethod $method |
30
|
|
|
* |
31
|
|
|
* @throws ResponseException |
32
|
|
|
* |
33
|
|
|
* @return bool |
34
|
|
|
*/ |
35
|
3 |
|
public function answerCallbackQuery(AnswerCallbackQueryMethod $method): bool |
36
|
|
|
{ |
37
|
3 |
|
return $this->answer($method); |
38
|
|
|
} |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @param AnswerInlineQueryMethod $method |
42
|
|
|
* |
43
|
|
|
* @throws ResponseException |
44
|
|
|
* |
45
|
|
|
* @return bool |
46
|
|
|
*/ |
47
|
2 |
|
public function answerInlineQuery(AnswerInlineQueryMethod $method): bool |
48
|
|
|
{ |
49
|
2 |
|
return $this->answer($method); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @param AnswerPreCheckoutQueryMethod $method |
54
|
|
|
* |
55
|
|
|
* @throws ResponseException |
56
|
|
|
* |
57
|
|
|
* @return bool |
58
|
|
|
*/ |
59
|
2 |
|
public function answerPreCheckoutQuery(AnswerPreCheckoutQueryMethod $method): bool |
60
|
|
|
{ |
61
|
2 |
|
return $this->answer($method); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @param AnswerShippingQueryMethod $method |
66
|
|
|
* |
67
|
|
|
* @throws ResponseException |
68
|
|
|
* |
69
|
|
|
* @return bool |
70
|
|
|
*/ |
71
|
2 |
|
public function answerShippingQuery(AnswerShippingQueryMethod $method): bool |
72
|
|
|
{ |
73
|
2 |
|
return $this->answer($method); |
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|