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