1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace NotificationChannels\WhatsApp; |
4
|
|
|
|
5
|
|
|
class Component |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* Currency code as defined in ISO 4217. |
9
|
|
|
*/ |
10
|
1 |
|
public static function currency(float $amount, string $code = 'EUR'): Component\Currency |
11
|
|
|
{ |
12
|
1 |
|
return new Component\Currency($amount, $code); |
13
|
|
|
} |
14
|
|
|
|
15
|
1 |
|
public static function dateTime(\DateTimeImmutable $dateTime, string $format = 'Y-m-d H:i:s'): Component\DateTime |
16
|
|
|
{ |
17
|
1 |
|
return new Component\DateTime($dateTime, $format); |
18
|
|
|
} |
19
|
|
|
|
20
|
1 |
|
public static function document(string $link, string $filename = null): Component\Document |
21
|
|
|
{ |
22
|
1 |
|
return new Component\Document($link, $filename); |
23
|
|
|
} |
24
|
|
|
|
25
|
1 |
|
public static function image(string $link): Component\Image |
26
|
|
|
{ |
27
|
1 |
|
return new Component\Image($link); |
28
|
|
|
} |
29
|
|
|
|
30
|
1 |
|
public static function text(string $text): Component\Text |
31
|
|
|
{ |
32
|
1 |
|
return new Component\Text($text); |
33
|
|
|
} |
34
|
|
|
|
35
|
1 |
|
public static function video(string $link): Component\Video |
36
|
|
|
{ |
37
|
1 |
|
return new Component\Video($link); |
38
|
|
|
} |
39
|
|
|
|
40
|
1 |
|
public static function urlButton(array $urls): Component\UrlButton |
41
|
|
|
{ |
42
|
1 |
|
return new Component\UrlButton($urls); |
43
|
|
|
} |
44
|
|
|
|
45
|
1 |
|
public static function quickReplyButton(array $payloads): Component\QuickReplyButton |
46
|
|
|
{ |
47
|
1 |
|
return new Component\QuickReplyButton($payloads); |
48
|
|
|
} |
49
|
|
|
|
50
|
1 |
|
public static function flowButton(string $token, array $data): Component\FlowButton |
51
|
|
|
{ |
52
|
1 |
|
return new Component\FlowButton($token, $data); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public static function location(string $name, string $address, float $latitude, float $longitude): Component\Location |
56
|
|
|
{ |
57
|
|
|
return new Component\Location($name, $address, $latitude, $longitude); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|