1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace NotificationChannels\Smsapi; |
4
|
|
|
|
5
|
|
|
use NotificationChannels\Smsapi\Exceptions\ExceptionFactory; |
6
|
|
|
|
7
|
|
|
abstract class SmsapiMessage |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* @internal |
11
|
|
|
* @var array |
12
|
|
|
*/ |
13
|
|
|
public $data = []; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @param string|string[] $to |
17
|
|
|
* @return self |
18
|
|
|
*/ |
19
|
16 |
|
public function to($to) |
20
|
|
|
{ |
21
|
16 |
|
ExceptionFactory::assertArgumentTypes(1, __METHOD__, ['string', 'array'], $to); |
22
|
7 |
|
$this->data['to'] = $to; |
23
|
|
|
|
24
|
7 |
|
return $this; |
25
|
|
|
} |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @param string $group |
29
|
|
|
* @return self |
30
|
|
|
*/ |
31
|
15 |
|
public function group($group) |
32
|
|
|
{ |
33
|
15 |
|
ExceptionFactory::assertArgumentType(1, __METHOD__, 'string', $group); |
34
|
3 |
|
$this->data['group'] = $group; |
35
|
|
|
|
36
|
3 |
|
return $this; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @param int|string $date |
41
|
|
|
* @return self |
42
|
|
|
*/ |
43
|
15 |
|
public function date($date) |
44
|
|
|
{ |
45
|
15 |
|
ExceptionFactory::assertArgumentTypes(1, __METHOD__, ['integer', 'string'], $date); |
46
|
6 |
|
$this->data['date'] = $date; |
47
|
|
|
|
48
|
6 |
|
return $this; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @param string $notifyUrl |
53
|
|
|
* @return self |
54
|
|
|
*/ |
55
|
15 |
|
public function notifyUrl($notifyUrl) |
56
|
|
|
{ |
57
|
15 |
|
ExceptionFactory::assertArgumentType(1, __METHOD__, 'string', $notifyUrl); |
58
|
3 |
|
$this->data['notify_url'] = $notifyUrl; |
59
|
|
|
|
60
|
3 |
|
return $this; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @param string $partner |
65
|
|
|
* @return self |
66
|
|
|
*/ |
67
|
15 |
|
public function partner($partner) |
68
|
|
|
{ |
69
|
15 |
|
ExceptionFactory::assertArgumentType(1, __METHOD__, 'string', $partner); |
70
|
3 |
|
$this->data['partner'] = $partner; |
71
|
|
|
|
72
|
3 |
|
return $this; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @param bool $test |
77
|
|
|
* @return self |
78
|
|
|
*/ |
79
|
18 |
|
public function test($test) |
80
|
|
|
{ |
81
|
18 |
|
ExceptionFactory::assertArgumentType(1, __METHOD__, 'boolean', $test); |
82
|
6 |
|
$this->data['test'] = $test; |
83
|
|
|
|
84
|
6 |
|
return $this; |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|