Total Complexity | 6 |
Total Lines | 78 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
5 | class AfricasTalkingMessage |
||
6 | { |
||
7 | /** @var string */ |
||
8 | protected $content; |
||
9 | |||
10 | /** @var string|null */ |
||
11 | protected $from; |
||
12 | |||
13 | /** @var string|null */ |
||
14 | protected $to; |
||
15 | |||
16 | /** |
||
17 | * Set content for this message. |
||
18 | * |
||
19 | 1 | * @param string $content |
|
20 | * @return this |
||
21 | 1 | */ |
|
22 | public function content(string $content): self |
||
23 | 1 | { |
|
24 | $this->content = trim($content); |
||
25 | |||
26 | return $this; |
||
27 | } |
||
28 | |||
29 | /** |
||
30 | * Set sender for this message. |
||
31 | * |
||
32 | 1 | * @param string $from |
|
33 | * @return self |
||
34 | 1 | */ |
|
35 | public function from(string $from): self |
||
40 | } |
||
41 | |||
42 | /** |
||
43 | * Set recipient for this message. |
||
44 | 2 | * |
|
45 | * @param string $from |
||
46 | 2 | * @return self |
|
47 | */ |
||
48 | public function to(string $to): self |
||
49 | { |
||
50 | $this->to = trim($to); |
||
51 | |||
52 | return $this; |
||
53 | } |
||
54 | 3 | ||
55 | /** |
||
56 | 3 | * Get message content. |
|
57 | * |
||
58 | * @return string |
||
59 | */ |
||
60 | public function getContent() |
||
61 | { |
||
62 | return $this->content; |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * Get sender info. |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | public function getSender() |
||
71 | { |
||
72 | return $this->from ?? config('services.africastalking.from'); |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * Get recipient info. |
||
77 | * |
||
78 | * @return string |
||
79 | */ |
||
80 | public function getTo() |
||
83 | } |
||
84 | } |
||
85 |