Skip to content

Commit d2b7570

Browse files
committed
fix SmsParams.delay format
1 parent 02e9c07 commit d2b7570

File tree

1 file changed

+72
-35
lines changed

1 file changed

+72
-35
lines changed

src/Params/SmsParams.php

Lines changed: 72 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
use DateTime;
66

7-
class SmsParams implements ParamsInterface {
7+
class SmsParams implements ParamsInterface
8+
{
89
protected ?DateTime $delay = null;
910
protected array $files = [];
1011
protected ?bool $flash = null;
@@ -20,161 +21,197 @@ class SmsParams implements ParamsInterface {
2021
protected ?bool $unicode = null;
2122
protected ?bool $utf8 = null;
2223

23-
public function __construct(string $text, string ...$to) {
24+
public function __construct(string $text, string ...$to)
25+
{
2426
$this->text = $text;
2527
$this->to = $to;
2628
}
2729

28-
public function getDelay(): ?DateTime {
30+
public function getDelay(): ?DateTime
31+
{
2932
return $this->delay;
3033
}
3134

32-
public function setDelay(?DateTime $delay): self {
35+
public function setDelay(?DateTime $delay): self
36+
{
3337
$this->delay = $delay;
3438
return $this;
3539
}
3640

37-
public function addFile(array $file): self {
41+
public function addFile(array $file): self
42+
{
3843
$this->files[] = $file;
3944
return $this;
4045
}
4146

42-
public function getFiles(): array {
47+
public function getFiles(): array
48+
{
4349
return $this->files;
4450
}
4551

46-
public function setFiles(array $files): self {
52+
public function setFiles(array $files): self
53+
{
4754
$this->files = $files;
4855
return $this;
4956
}
5057

51-
public function removeFile(int $index): self {
58+
public function removeFile(int $index): self
59+
{
5260
unset($this->files[$index]);
5361
return $this;
5462
}
5563

56-
public function removeFiles(): self {
64+
public function removeFiles(): self
65+
{
5766
$this->files = [];
5867
return $this;
5968
}
6069

61-
public function getFlash(): ?bool {
70+
public function getFlash(): ?bool
71+
{
6272
return $this->flash;
6373
}
6474

65-
public function setFlash(?bool $flash): self {
75+
public function setFlash(?bool $flash): self
76+
{
6677
$this->flash = $flash;
6778
return $this;
6879
}
6980

70-
public function getForeignId(): ?string {
81+
public function getForeignId(): ?string
82+
{
7183
return $this->foreign_id;
7284
}
7385

74-
public function setForeignId(?string $foreignId): self {
86+
public function setForeignId(?string $foreignId): self
87+
{
7588
$this->foreign_id = $foreignId;
7689
return $this;
7790
}
7891

79-
public function getFrom(): ?string {
92+
public function getFrom(): ?string
93+
{
8094
return $this->from;
8195
}
8296

83-
public function setFrom(?string $from): self {
97+
public function setFrom(?string $from): self
98+
{
8499
$this->from = $from;
85100
return $this;
86101
}
87102

88-
public function getLabel(): ?string {
103+
public function getLabel(): ?string
104+
{
89105
return $this->label;
90106
}
91107

92-
public function setLabel(?string $label): self {
108+
public function setLabel(?string $label): self
109+
{
93110
$this->label = $label;
94111
return $this;
95112
}
96113

97-
public function getNoReload(): ?bool {
114+
public function getNoReload(): ?bool
115+
{
98116
return $this->no_reload;
99117
}
100118

101-
public function setNoReload(?bool $noReload): self {
119+
public function setNoReload(?bool $noReload): self
120+
{
102121
$this->no_reload = $noReload;
103122
return $this;
104123
}
105124

106-
public function getPerformanceTracking(): ?bool {
125+
public function getPerformanceTracking(): ?bool
126+
{
107127
return $this->performance_tracking;
108128
}
109129

110-
public function setPerformanceTracking(?bool $performanceTracking): self {
130+
public function setPerformanceTracking(?bool $performanceTracking): self
131+
{
111132
$this->performance_tracking = $performanceTracking;
112133
return $this;
113134
}
114135

115-
public function getText(): string {
136+
public function getText(): string
137+
{
116138
return $this->text;
117139
}
118140

119-
public function setText(string $text): self {
141+
public function setText(string $text): self
142+
{
120143
$this->text = $text;
121144
return $this;
122145
}
123146

124-
public function addTo(string ...$to): self {
147+
public function addTo(string ...$to): self
148+
{
125149
$this->to = [...$this->to, ...$to];
126150
return $this;
127151
}
128152

129-
public function getTo(): array {
153+
public function getTo(): array
154+
{
130155
return $this->to;
131156
}
132157

133-
public function setTo(array $to): self {
158+
public function setTo(array $to): self
159+
{
134160
$this->to = $to;
135161
return $this;
136162
}
137163

138-
public function getTtl(): ?int {
164+
public function getTtl(): ?int
165+
{
139166
return $this->ttl;
140167
}
141168

142-
public function setTtl(?int $ttl): self {
169+
public function setTtl(?int $ttl): self
170+
{
143171
$this->ttl = $ttl;
144172
return $this;
145173
}
146174

147-
public function getUdh(): ?string {
175+
public function getUdh(): ?string
176+
{
148177
return $this->udh;
149178
}
150179

151-
public function setUdh(?string $udh): self {
180+
public function setUdh(?string $udh): self
181+
{
152182
$this->udh = $udh;
153183
return $this;
154184
}
155185

156-
public function getUnicode(): ?bool {
186+
public function getUnicode(): ?bool
187+
{
157188
return $this->unicode;
158189
}
159190

160-
public function setUnicode(?bool $unicode): self {
191+
public function setUnicode(?bool $unicode): self
192+
{
161193
$this->unicode = $unicode;
162194
return $this;
163195
}
164196

165-
public function getUtf8(): ?bool {
197+
public function getUtf8(): ?bool
198+
{
166199
return $this->utf8;
167200
}
168201

169-
public function setUtf8(?bool $utf8): self {
202+
public function setUtf8(?bool $utf8): self
203+
{
170204
$this->utf8 = $utf8;
171205
return $this;
172206
}
173207

174-
public function toArray(): array {
208+
public function toArray(): array
209+
{
175210
$arr = get_object_vars($this);
176211
$arr['to'] = implode(',', $this->to);
177212

213+
if ($this->delay) $arr['delay'] = $this->delay->format('Y-m-d h:i');
214+
178215
return $arr;
179216
}
180217
}

0 commit comments

Comments
 (0)