This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php declare(strict_types=1); |
||
2 | namespace Loevgaard\Linkmobility\Request; |
||
3 | |||
4 | use Assert\Assert; |
||
5 | use Loevgaard\Linkmobility\Response\BatchStatusResponse; |
||
6 | use Loevgaard\Linkmobility\ValueObject\Message; |
||
7 | use Loevgaard\Linkmobility\ValueObject\Recipient; |
||
8 | use Loevgaard\Linkmobility\ValueObject\Sender; |
||
9 | |||
10 | /** |
||
11 | * @link https://linkmobility.atlassian.net/wiki/spaces/COOL/pages/26017807/08.+Messages |
||
12 | */ |
||
13 | class PostMessageRequest extends Request |
||
14 | { |
||
15 | /* |
||
16 | * Show message directly on phone. The message is not saved on the phone. (Also known as flash messages) |
||
17 | */ |
||
18 | const CLASS_0 = 0; |
||
19 | |||
20 | /* |
||
21 | * Save message in phone memory. Either on the phone or in SIM. |
||
22 | */ |
||
23 | const CLASS_1 = 1; |
||
24 | |||
25 | /* |
||
26 | * Message contains SIM data. |
||
27 | */ |
||
28 | const CLASS_2 = 2; |
||
29 | |||
30 | /* |
||
31 | * Message contains info that indicate that it should be |
||
32 | * sent to external units, normally used by terminal equipment. |
||
33 | */ |
||
34 | const CLASS_3 = 3; |
||
35 | |||
36 | /* |
||
37 | * Send normal message (160 chars, but if more than 160 chars, 153 chars per part message) |
||
38 | */ |
||
39 | const FORMAT_GSM = 'GSM'; |
||
40 | |||
41 | /* |
||
42 | * To send speciality chars like chinese letters. A normal message is 160 chars, but ifyou use |
||
43 | * unicode each message can only hold 70 chars (But if more than 70 chars, 67 chars per part message) |
||
44 | */ |
||
45 | const FORMAT_UNICODE = 'UNICODE'; |
||
46 | |||
47 | /* |
||
48 | * Send a binary message body in hex and define udh |
||
49 | */ |
||
50 | const FORMAT_BINARY = 'BINARY'; |
||
51 | |||
52 | /* |
||
53 | * Send a link that is opened on the phone |
||
54 | */ |
||
55 | const FORMAT_WAPPUSH = 'WAPPUSH'; |
||
56 | |||
57 | /* |
||
58 | * Array of attachments to send as MMS To send a presentation, the first attachment |
||
59 | * needs to be a SMIL document with the extension .smil Sender should be a valid shortcode |
||
60 | */ |
||
61 | const FORMAT_MMS = 'MMS'; |
||
62 | |||
63 | /** |
||
64 | * @var Recipient[] |
||
65 | */ |
||
66 | protected $recipients; |
||
67 | |||
68 | /** |
||
69 | * @var Sender |
||
70 | */ |
||
71 | protected $sender; |
||
72 | |||
73 | /** |
||
74 | * @var Message |
||
75 | */ |
||
76 | protected $message; |
||
77 | |||
78 | /** |
||
79 | * @var boolean |
||
80 | */ |
||
81 | protected $status; |
||
82 | |||
83 | /** |
||
84 | * @var string |
||
85 | */ |
||
86 | protected $statusUrl; |
||
87 | |||
88 | /** |
||
89 | * @var string |
||
90 | */ |
||
91 | protected $returnData; |
||
92 | |||
93 | /** |
||
94 | * @var int |
||
95 | */ |
||
96 | protected $class; |
||
97 | |||
98 | /** |
||
99 | * @var \DateTimeInterface |
||
100 | */ |
||
101 | protected $sendTime; |
||
102 | |||
103 | /** |
||
104 | * @var int |
||
105 | */ |
||
106 | protected $price; |
||
107 | |||
108 | /** |
||
109 | * @var boolean |
||
110 | */ |
||
111 | protected $charity; |
||
112 | |||
113 | /** |
||
114 | * @var string |
||
115 | */ |
||
116 | protected $invoiceText; |
||
117 | |||
118 | /** |
||
119 | * @var int |
||
120 | */ |
||
121 | protected $validity; |
||
122 | |||
123 | /** |
||
124 | * @var integer |
||
125 | */ |
||
126 | protected $contentType; |
||
127 | |||
128 | /** |
||
129 | * @var string |
||
130 | */ |
||
131 | protected $format; |
||
132 | |||
133 | /** |
||
134 | * @var string |
||
135 | */ |
||
136 | protected $udh; |
||
137 | |||
138 | /** |
||
139 | * @var array |
||
140 | */ |
||
141 | protected $attachment; |
||
142 | |||
143 | /** |
||
144 | * @var string |
||
145 | */ |
||
146 | protected $pushUrl; |
||
147 | |||
148 | /** |
||
149 | * @var string |
||
150 | */ |
||
151 | protected $pushExpire; |
||
152 | |||
153 | /** |
||
154 | * @var array |
||
155 | */ |
||
156 | protected $filter; |
||
157 | |||
158 | /** |
||
159 | * @var array |
||
160 | */ |
||
161 | protected $segmentation; |
||
162 | |||
163 | /** |
||
164 | * @var int |
||
165 | */ |
||
166 | protected $pid; |
||
167 | |||
168 | /** |
||
169 | * @var string |
||
170 | */ |
||
171 | protected $advanced; |
||
172 | |||
173 | /** |
||
174 | * @var string |
||
175 | */ |
||
176 | protected $protocol; |
||
177 | |||
178 | /** |
||
179 | * @var string |
||
180 | */ |
||
181 | protected $revenueText; |
||
182 | |||
183 | 3 | public function __construct(Sender $sender, Message $message, array $recipients) |
|
184 | { |
||
185 | 3 | $this->setSender($sender); |
|
186 | 3 | $this->setMessage($message); |
|
187 | 3 | $this->setRecipients($recipients); |
|
188 | 3 | } |
|
189 | |||
190 | /** |
||
191 | * @inheritdoc |
||
192 | */ |
||
193 | 1 | public function validate(): void |
|
194 | { |
||
195 | 1 | parent::validate(); |
|
196 | |||
197 | 1 | Assert::that($this->recipients)->isArray()->notEmpty(); |
|
198 | 1 | Assert::thatAll($this->recipients)->isInstanceOf(Recipient::class); |
|
199 | |||
200 | // optional properties |
||
201 | 1 | Assert::thatNullOr($this->status)->boolean(); |
|
202 | 1 | Assert::thatNullOr($this->statusUrl)->url(); |
|
203 | 1 | Assert::thatNullOr($this->returnData)->string()->notEmpty(); |
|
204 | 1 | Assert::thatNullOr($this->class)->integer()->choice(static::getClasses()); |
|
205 | 1 | Assert::thatNullOr($this->sendTime)->isInstanceOf(\DateTimeInterface::class); |
|
206 | 1 | Assert::thatNullOr($this->price)->integer()->greaterOrEqualThan(100); |
|
207 | 1 | Assert::thatNullOr($this->charity)->boolean(); |
|
208 | 1 | Assert::thatNullOr($this->invoiceText)->string()->notEmpty(); |
|
209 | 1 | Assert::thatNullOr($this->validity)->integer(); |
|
210 | 1 | Assert::thatNullOr($this->contentType)->integer(); |
|
211 | 1 | Assert::thatNullOr($this->format)->string()->choice(static::getFormats()); |
|
212 | 1 | Assert::thatNullOr($this->udh)->string()->notEmpty(); |
|
213 | 1 | Assert::thatNullOr($this->attachment)->isArray()->notEmpty(); |
|
214 | 1 | Assert::thatNullOr($this->pushUrl)->url(); |
|
215 | 1 | Assert::thatNullOr($this->pushExpire)->string()->notEmpty(); |
|
216 | 1 | Assert::thatNullOr($this->filter)->isArray()->notEmpty(); |
|
217 | 1 | Assert::thatNullOr($this->segmentation)->isArray()->notEmpty(); |
|
218 | 1 | Assert::thatNullOr($this->pid)->integer(); |
|
219 | 1 | Assert::thatNullOr($this->advanced)->string()->notEmpty(); |
|
220 | 1 | Assert::thatNullOr($this->protocol)->string()->notEmpty(); |
|
221 | 1 | Assert::thatNullOr($this->revenueText)->string()->notEmpty(); |
|
222 | 1 | } |
|
223 | |||
224 | 1 | public function getMethod(): string |
|
225 | { |
||
226 | 1 | return RequestInterface::METHOD_POST; |
|
227 | } |
||
228 | |||
229 | 1 | public function getUri(): string |
|
230 | { |
||
231 | 1 | return '/message.json'; |
|
232 | } |
||
233 | |||
234 | 1 | public function getBody(): array |
|
235 | { |
||
236 | $body = [ |
||
237 | 1 | 'recipients' => join(',', $this->recipients), |
|
238 | 1 | 'sender' => $this->sender->get(), |
|
239 | 1 | 'message' => $this->message->get(), |
|
240 | 1 | 'status' => $this->status, |
|
241 | 1 | 'statusurl' => $this->statusUrl, |
|
242 | 1 | 'returndata' => $this->returnData, |
|
243 | 1 | 'class' => $this->class, |
|
244 | 1 | 'sendtime' => $this->sendTime ? $this->sendTime->format('d-m-Y H:i') : null, |
|
245 | 1 | 'price' => $this->price, |
|
246 | 1 | 'charity' => $this->charity, |
|
247 | 1 | 'invoicetext' => $this->invoiceText, |
|
248 | 1 | 'validity' => $this->validity, |
|
249 | 1 | 'contenttype' => $this->contentType, |
|
250 | 1 | 'format' => $this->format, |
|
251 | 1 | 'udh' => $this->udh, |
|
252 | 1 | 'attachment' => $this->attachment, |
|
253 | 1 | 'pushurl' => $this->pushUrl, |
|
254 | 1 | 'pushexpire' => $this->pushExpire, |
|
255 | 1 | 'filter' => $this->filter, |
|
256 | 1 | 'segmentation' => $this->segmentation, |
|
257 | 1 | 'pid' => $this->pid, |
|
258 | 1 | 'advanced' => $this->advanced, |
|
259 | 1 | 'protocol' => $this->protocol, |
|
260 | 1 | 'revenuetext' => $this->revenueText |
|
261 | ]; |
||
262 | |||
263 | 1 | $body = array_filter($body, function ($elm) { |
|
264 | 1 | return !is_null($elm); |
|
265 | 1 | }); |
|
266 | |||
267 | // we wrap the payload in a message array according to |
||
268 | // https://linkmobility.atlassian.net/wiki/spaces/COOL/pages/26017829/Sending+SMS |
||
269 | return [ |
||
270 | 1 | 'message' => $body |
|
271 | ]; |
||
272 | } |
||
273 | |||
274 | 1 | public function getResponseClass(): string |
|
275 | { |
||
276 | 1 | return BatchStatusResponse::class; |
|
277 | } |
||
278 | |||
279 | 3 | public function addRecipient(Recipient $recipient) : PostMessageRequest |
|
280 | { |
||
281 | 3 | $this->recipients[] = $recipient; |
|
282 | 3 | return $this; |
|
283 | } |
||
284 | |||
285 | /** |
||
286 | * Returns the possible classes for the payload |
||
287 | * |
||
288 | * @return array |
||
289 | */ |
||
290 | 1 | View Code Duplication | public static function getClasses() : array |
0 ignored issues
–
show
|
|||
291 | { |
||
292 | return [ |
||
293 | 1 | self::CLASS_0 => self::CLASS_0, |
|
294 | 1 | self::CLASS_1 => self::CLASS_1, |
|
295 | 1 | self::CLASS_2 => self::CLASS_2, |
|
296 | 1 | self::CLASS_3 => self::CLASS_3 |
|
297 | ]; |
||
298 | } |
||
299 | |||
300 | /** |
||
301 | * Returns the possible formats for the payload |
||
302 | * |
||
303 | * @return array |
||
304 | */ |
||
305 | 1 | View Code Duplication | public static function getFormats() : array |
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
306 | { |
||
307 | return [ |
||
308 | 1 | self::FORMAT_GSM => self::FORMAT_GSM, |
|
309 | 1 | self::FORMAT_UNICODE => self::FORMAT_UNICODE, |
|
310 | 1 | self::FORMAT_BINARY => self::FORMAT_BINARY, |
|
311 | 1 | self::FORMAT_WAPPUSH => self::FORMAT_WAPPUSH, |
|
312 | 1 | self::FORMAT_MMS => self::FORMAT_MMS |
|
313 | ]; |
||
314 | } |
||
315 | |||
316 | /* |
||
317 | * Getters / Setters |
||
318 | */ |
||
319 | |||
320 | /** |
||
321 | * @return Recipient[] |
||
322 | */ |
||
323 | 1 | public function getRecipients(): array |
|
324 | { |
||
325 | 1 | return $this->recipients; |
|
326 | } |
||
327 | |||
328 | /** |
||
329 | * @param Recipient[] $recipients |
||
330 | * @return PostMessageRequest |
||
331 | */ |
||
332 | 3 | public function setRecipients(array $recipients) |
|
333 | { |
||
334 | 3 | foreach ($recipients as $recipient) { |
|
335 | 3 | $this->addRecipient($recipient); |
|
336 | } |
||
337 | |||
338 | 3 | return $this; |
|
339 | } |
||
340 | |||
341 | /** |
||
342 | * @return Sender |
||
343 | */ |
||
344 | 1 | public function getSender(): Sender |
|
345 | { |
||
346 | 1 | return $this->sender; |
|
347 | } |
||
348 | |||
349 | /** |
||
350 | * @param Sender $sender |
||
351 | * @return PostMessageRequest |
||
352 | */ |
||
353 | 3 | public function setSender(Sender $sender) |
|
354 | { |
||
355 | 3 | $this->sender = $sender; |
|
356 | 3 | return $this; |
|
357 | } |
||
358 | |||
359 | /** |
||
360 | * @return Message |
||
361 | */ |
||
362 | 1 | public function getMessage(): Message |
|
363 | { |
||
364 | 1 | return $this->message; |
|
365 | } |
||
366 | |||
367 | /** |
||
368 | * @param Message $message |
||
369 | * @return PostMessageRequest |
||
370 | */ |
||
371 | 3 | public function setMessage(Message $message) |
|
372 | { |
||
373 | 3 | $this->message = $message; |
|
374 | |||
375 | 3 | if ($this->message->isGsm7()) { |
|
376 | 2 | $this->setFormat(self::FORMAT_GSM); |
|
377 | } else { |
||
378 | 1 | $this->setFormat(self::FORMAT_UNICODE); |
|
379 | } |
||
380 | |||
381 | 3 | return $this; |
|
382 | } |
||
383 | |||
384 | /** |
||
385 | * @return bool |
||
386 | */ |
||
387 | 1 | public function isStatus(): bool |
|
388 | { |
||
389 | 1 | return $this->status; |
|
390 | } |
||
391 | |||
392 | /** |
||
393 | * @param bool $status |
||
394 | * @return PostMessageRequest |
||
395 | */ |
||
396 | 1 | public function setStatus(bool $status) |
|
397 | { |
||
398 | 1 | $this->status = $status; |
|
399 | 1 | return $this; |
|
400 | } |
||
401 | |||
402 | /** |
||
403 | * @return string |
||
404 | */ |
||
405 | 1 | public function getStatusUrl(): string |
|
406 | { |
||
407 | 1 | return $this->statusUrl; |
|
408 | } |
||
409 | |||
410 | /** |
||
411 | * @param string $statusUrl |
||
412 | * @return PostMessageRequest |
||
413 | */ |
||
414 | 1 | public function setStatusUrl(string $statusUrl) |
|
415 | { |
||
416 | 1 | $this->statusUrl = $statusUrl; |
|
417 | 1 | return $this; |
|
418 | } |
||
419 | |||
420 | /** |
||
421 | * @return string |
||
422 | */ |
||
423 | 1 | public function getReturnData(): string |
|
424 | { |
||
425 | 1 | return $this->returnData; |
|
426 | } |
||
427 | |||
428 | /** |
||
429 | * @param string $returnData |
||
430 | * @return PostMessageRequest |
||
431 | */ |
||
432 | 1 | public function setReturnData(string $returnData) |
|
433 | { |
||
434 | 1 | $this->returnData = $returnData; |
|
435 | 1 | return $this; |
|
436 | } |
||
437 | |||
438 | /** |
||
439 | * @return int |
||
440 | */ |
||
441 | 1 | public function getClass(): int |
|
442 | { |
||
443 | 1 | return $this->class; |
|
444 | } |
||
445 | |||
446 | /** |
||
447 | * @param int $class |
||
448 | * @return PostMessageRequest |
||
449 | */ |
||
450 | 1 | public function setClass(int $class) |
|
451 | { |
||
452 | 1 | $this->class = $class; |
|
453 | 1 | return $this; |
|
454 | } |
||
455 | |||
456 | /** |
||
457 | * @return \DateTimeInterface |
||
458 | */ |
||
459 | 1 | public function getSendTime(): \DateTimeInterface |
|
460 | { |
||
461 | 1 | return $this->sendTime; |
|
462 | } |
||
463 | |||
464 | /** |
||
465 | * @param \DateTimeInterface $sendTime |
||
466 | * @return PostMessageRequest |
||
467 | */ |
||
468 | 1 | public function setSendTime(\DateTimeInterface $sendTime) |
|
469 | { |
||
470 | 1 | $this->sendTime = $sendTime; |
|
471 | 1 | return $this; |
|
472 | } |
||
473 | |||
474 | /** |
||
475 | * @return int |
||
476 | */ |
||
477 | 1 | public function getPrice(): int |
|
478 | { |
||
479 | 1 | return $this->price; |
|
480 | } |
||
481 | |||
482 | /** |
||
483 | * @param int $price |
||
484 | * @return PostMessageRequest |
||
485 | */ |
||
486 | 1 | public function setPrice(int $price) |
|
487 | { |
||
488 | 1 | $this->price = $price; |
|
489 | 1 | return $this; |
|
490 | } |
||
491 | |||
492 | /** |
||
493 | * @return bool |
||
494 | */ |
||
495 | 1 | public function isCharity(): bool |
|
496 | { |
||
497 | 1 | return $this->charity; |
|
498 | } |
||
499 | |||
500 | /** |
||
501 | * @param bool $charity |
||
502 | * @return PostMessageRequest |
||
503 | */ |
||
504 | 1 | public function setCharity(bool $charity) |
|
505 | { |
||
506 | 1 | $this->charity = $charity; |
|
507 | 1 | return $this; |
|
508 | } |
||
509 | |||
510 | /** |
||
511 | * @return string |
||
512 | */ |
||
513 | 1 | public function getInvoiceText(): string |
|
514 | { |
||
515 | 1 | return $this->invoiceText; |
|
516 | } |
||
517 | |||
518 | /** |
||
519 | * @param string $invoiceText |
||
520 | * @return PostMessageRequest |
||
521 | */ |
||
522 | 1 | public function setInvoiceText(string $invoiceText) |
|
523 | { |
||
524 | 1 | $this->invoiceText = $invoiceText; |
|
525 | 1 | return $this; |
|
526 | } |
||
527 | |||
528 | /** |
||
529 | * @return int |
||
530 | */ |
||
531 | 1 | public function getValidity(): int |
|
532 | { |
||
533 | 1 | return $this->validity; |
|
534 | } |
||
535 | |||
536 | /** |
||
537 | * @param int|\DateInterval $validity In minutes |
||
538 | * @return PostMessageRequest |
||
539 | */ |
||
540 | 1 | public function setValidity($validity) |
|
541 | { |
||
542 | 1 | if ($validity instanceof \DateInterval) { |
|
543 | 1 | $now = new \DateTimeImmutable(); |
|
544 | 1 | $seconds = $now->add($validity)->getTimestamp() - $now->getTimestamp(); |
|
545 | 1 | $validity = ceil($seconds / 60); |
|
546 | } |
||
547 | |||
548 | 1 | $validity = (int)$validity; |
|
549 | |||
550 | 1 | $this->validity = $validity; |
|
551 | 1 | return $this; |
|
552 | } |
||
553 | |||
554 | /** |
||
555 | * @return int |
||
556 | */ |
||
557 | 1 | public function getContentType(): int |
|
558 | { |
||
559 | 1 | return $this->contentType; |
|
560 | } |
||
561 | |||
562 | /** |
||
563 | * @param int $contentType |
||
564 | * @return PostMessageRequest |
||
565 | */ |
||
566 | 1 | public function setContentType(int $contentType) |
|
567 | { |
||
568 | 1 | $this->contentType = $contentType; |
|
569 | 1 | return $this; |
|
570 | } |
||
571 | |||
572 | /** |
||
573 | * @return string |
||
574 | */ |
||
575 | 2 | public function getFormat(): string |
|
576 | { |
||
577 | 2 | return $this->format; |
|
578 | } |
||
579 | |||
580 | /** |
||
581 | * @param string $format |
||
582 | * @return PostMessageRequest |
||
583 | */ |
||
584 | 3 | public function setFormat(string $format) |
|
585 | { |
||
586 | 3 | $this->format = $format; |
|
587 | 3 | return $this; |
|
588 | } |
||
589 | |||
590 | /** |
||
591 | * @return string |
||
592 | */ |
||
593 | 1 | public function getUdh(): string |
|
594 | { |
||
595 | 1 | return $this->udh; |
|
596 | } |
||
597 | |||
598 | /** |
||
599 | * @param string $udh |
||
600 | * @return PostMessageRequest |
||
601 | */ |
||
602 | 1 | public function setUdh(string $udh) |
|
603 | { |
||
604 | 1 | $this->udh = $udh; |
|
605 | 1 | return $this; |
|
606 | } |
||
607 | |||
608 | /** |
||
609 | * @return array |
||
610 | */ |
||
611 | 1 | public function getAttachment(): array |
|
612 | { |
||
613 | 1 | return $this->attachment; |
|
614 | } |
||
615 | |||
616 | /** |
||
617 | * @param array $attachment |
||
618 | * @return PostMessageRequest |
||
619 | */ |
||
620 | 1 | public function setAttachment(array $attachment) |
|
621 | { |
||
622 | 1 | $this->attachment = $attachment; |
|
623 | 1 | return $this; |
|
624 | } |
||
625 | |||
626 | /** |
||
627 | * @return string |
||
628 | */ |
||
629 | 1 | public function getPushUrl(): string |
|
630 | { |
||
631 | 1 | return $this->pushUrl; |
|
632 | } |
||
633 | |||
634 | /** |
||
635 | * @param string $pushUrl |
||
636 | * @return PostMessageRequest |
||
637 | */ |
||
638 | 1 | public function setPushUrl(string $pushUrl) |
|
639 | { |
||
640 | 1 | $this->pushUrl = $pushUrl; |
|
641 | 1 | return $this; |
|
642 | } |
||
643 | |||
644 | /** |
||
645 | * @return string |
||
646 | */ |
||
647 | 1 | public function getPushExpire(): string |
|
648 | { |
||
649 | 1 | return $this->pushExpire; |
|
650 | } |
||
651 | |||
652 | /** |
||
653 | * @param string|\DateTimeInterface $pushExpire |
||
654 | * @return PostMessageRequest |
||
655 | */ |
||
656 | 1 | public function setPushExpire($pushExpire) |
|
657 | { |
||
658 | 1 | if ($pushExpire instanceof \DateTimeInterface) { |
|
659 | 1 | $pushExpire = (string)$pushExpire->getTimestamp(); |
|
660 | } |
||
661 | |||
662 | 1 | $this->pushExpire = $pushExpire; |
|
663 | 1 | return $this; |
|
664 | } |
||
665 | |||
666 | /** |
||
667 | * @return array |
||
668 | */ |
||
669 | 1 | public function getFilter(): array |
|
670 | { |
||
671 | 1 | return $this->filter; |
|
672 | } |
||
673 | |||
674 | /** |
||
675 | * @param array $filter |
||
676 | * @return PostMessageRequest |
||
677 | */ |
||
678 | 1 | public function setFilter(array $filter) |
|
679 | { |
||
680 | 1 | $this->filter = $filter; |
|
681 | 1 | return $this; |
|
682 | } |
||
683 | |||
684 | /** |
||
685 | * @return array |
||
686 | */ |
||
687 | 1 | public function getSegmentation(): array |
|
688 | { |
||
689 | 1 | return $this->segmentation; |
|
690 | } |
||
691 | |||
692 | /** |
||
693 | * @param array $segmentation |
||
694 | * @return PostMessageRequest |
||
695 | */ |
||
696 | 1 | public function setSegmentation(array $segmentation) |
|
697 | { |
||
698 | 1 | $this->segmentation = $segmentation; |
|
699 | 1 | return $this; |
|
700 | } |
||
701 | |||
702 | /** |
||
703 | * @return int |
||
704 | */ |
||
705 | 1 | public function getPid(): int |
|
706 | { |
||
707 | 1 | return $this->pid; |
|
708 | } |
||
709 | |||
710 | /** |
||
711 | * @param int $pid |
||
712 | * @return PostMessageRequest |
||
713 | */ |
||
714 | 1 | public function setPid(int $pid) |
|
715 | { |
||
716 | 1 | $this->pid = $pid; |
|
717 | 1 | return $this; |
|
718 | } |
||
719 | |||
720 | /** |
||
721 | * @return string |
||
722 | */ |
||
723 | 1 | public function getAdvanced(): string |
|
724 | { |
||
725 | 1 | return $this->advanced; |
|
726 | } |
||
727 | |||
728 | /** |
||
729 | * @param string $advanced |
||
730 | * @return PostMessageRequest |
||
731 | */ |
||
732 | 1 | public function setAdvanced(string $advanced) |
|
733 | { |
||
734 | 1 | $this->advanced = $advanced; |
|
735 | 1 | return $this; |
|
736 | } |
||
737 | |||
738 | /** |
||
739 | * @return string |
||
740 | */ |
||
741 | 1 | public function getProtocol(): string |
|
742 | { |
||
743 | 1 | return $this->protocol; |
|
744 | } |
||
745 | |||
746 | /** |
||
747 | * @param string $protocol |
||
748 | * @return PostMessageRequest |
||
749 | */ |
||
750 | 1 | public function setProtocol(string $protocol) |
|
751 | { |
||
752 | 1 | $this->protocol = $protocol; |
|
753 | 1 | return $this; |
|
754 | } |
||
755 | |||
756 | /** |
||
757 | * @return string |
||
758 | */ |
||
759 | 1 | public function getRevenueText(): string |
|
760 | { |
||
761 | 1 | return $this->revenueText; |
|
762 | } |
||
763 | |||
764 | /** |
||
765 | * @param string $revenueText |
||
766 | * @return PostMessageRequest |
||
767 | */ |
||
768 | 1 | public function setRevenueText(string $revenueText) |
|
769 | { |
||
770 | 1 | $this->revenueText = $revenueText; |
|
771 | 1 | return $this; |
|
772 | } |
||
773 | } |
||
774 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.