Total Complexity | 8 |
Total Lines | 60 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class WhatsAppTextMessage |
||
6 | { |
||
7 | /** |
||
8 | * WhatsApp ID or phone number for the person you want to send a message to. |
||
9 | */ |
||
10 | protected string $to; |
||
11 | |||
12 | /** |
||
13 | * Message. |
||
14 | */ |
||
15 | protected string $message; |
||
16 | |||
17 | /** |
||
18 | * The message type. |
||
19 | */ |
||
20 | protected static string $type = 'text'; |
||
21 | |||
22 | 4 | protected function __construct($to = '', $message = '') |
|
23 | { |
||
24 | 4 | $this->to = $to; |
|
25 | 4 | $this->message = $message; |
|
26 | } |
||
27 | |||
28 | 4 | public static function create($to = '', $message = ''): self |
|
29 | { |
||
30 | 4 | return new self($to, $message); |
|
31 | } |
||
32 | |||
33 | 2 | public function to(string $to): self |
|
34 | { |
||
35 | 2 | $this->to = $to; |
|
36 | |||
37 | 2 | return $this; |
|
38 | } |
||
39 | |||
40 | 1 | public function message(string $message): self |
|
41 | { |
||
42 | 1 | $this->message = $message; |
|
43 | |||
44 | 1 | return $this; |
|
45 | } |
||
46 | |||
47 | 1 | public function getMessage(): string |
|
48 | { |
||
49 | 1 | return $this->message; |
|
50 | } |
||
51 | |||
52 | 1 | public function recipient(): ?string |
|
55 | } |
||
56 | |||
57 | 1 | public function hasRecipient(): bool |
|
58 | { |
||
59 | 1 | return ! empty($this->to); |
|
60 | } |
||
61 | |||
62 | 1 | public function type(): string |
|
67 |