1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace TgBotApi\BotApiBase\Method; |
6
|
|
|
|
7
|
|
|
use TgBotApi\BotApiBase\Method\Interfaces\EditMethodAliasInterface; |
8
|
|
|
use TgBotApi\BotApiBase\Method\Traits\EditMessageVariablesTrait; |
9
|
|
|
use TgBotApi\BotApiBase\Method\Traits\FillFromArrayTrait; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Class EditMessageLiveLocationMethod. |
13
|
|
|
* |
14
|
|
|
* @see https://core.telegram.org/bots/api#editmessagelivelocation |
15
|
|
|
*/ |
16
|
|
|
class EditMessageLiveLocationMethod implements EditMethodAliasInterface |
17
|
|
|
{ |
18
|
|
|
use EditMessageVariablesTrait; |
19
|
|
|
use FillFromArrayTrait; |
20
|
|
|
/** |
21
|
|
|
* Latitude of the location. |
22
|
|
|
* |
23
|
|
|
* @var float |
24
|
|
|
*/ |
25
|
|
|
public $latitude; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* Longitude of the location. |
29
|
|
|
* |
30
|
|
|
* @var float |
31
|
|
|
*/ |
32
|
|
|
public $longitude; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @param int|string $chatId |
36
|
|
|
* @param int $messageId |
37
|
|
|
* @param float $latitude |
38
|
|
|
* @param float $longitude |
39
|
|
|
* @param array|null $data |
40
|
|
|
* |
41
|
|
|
* @throws \TgBotApi\BotApiBase\Exception\BadArgumentException |
42
|
|
|
* |
43
|
|
|
* @return EditMessageLiveLocationMethod |
44
|
|
|
*/ |
45
|
1 |
|
public static function create( |
46
|
|
|
$chatId, |
47
|
|
|
int $messageId, |
48
|
|
|
float $latitude, |
49
|
|
|
float $longitude, |
50
|
|
|
array $data = null |
51
|
|
|
): EditMessageLiveLocationMethod { |
52
|
1 |
|
$instance = new static(); |
53
|
1 |
|
$instance->chatId = $chatId; |
54
|
1 |
|
$instance->messageId = $messageId; |
55
|
1 |
|
$instance->latitude = $latitude; |
56
|
1 |
|
$instance->longitude = $longitude; |
57
|
1 |
|
if ($data) { |
58
|
1 |
|
$instance->fill($data, ['chatId', 'messageId', 'latitude', 'longitude', 'inlineMessageId']); |
59
|
|
|
} |
60
|
|
|
|
61
|
1 |
|
return $instance; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @param string $inlineMessageId |
66
|
|
|
* @param float $latitude |
67
|
|
|
* @param float $longitude |
68
|
|
|
* @param array|null $data |
69
|
|
|
* |
70
|
|
|
* @throws \TgBotApi\BotApiBase\Exception\BadArgumentException |
71
|
|
|
* |
72
|
|
|
* @return EditMessageLiveLocationMethod |
73
|
|
|
*/ |
74
|
1 |
|
public static function createInline( |
75
|
|
|
string $inlineMessageId, |
76
|
|
|
float $latitude, |
77
|
|
|
float $longitude, |
78
|
|
|
array $data = null |
79
|
|
|
): EditMessageLiveLocationMethod { |
80
|
1 |
|
$instance = new static(); |
81
|
1 |
|
$instance->latitude = $latitude; |
82
|
1 |
|
$instance->longitude = $longitude; |
83
|
1 |
|
$instance->inlineMessageId = $inlineMessageId; |
84
|
1 |
|
if ($data) { |
85
|
1 |
|
$instance->fill($data, ['chatId', 'latitude', 'longitude', 'inlineMessageId']); |
86
|
|
|
} |
87
|
|
|
|
88
|
1 |
|
return $instance; |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|