| @@ 12-94 (lines=83) @@ | ||
| 9 | /** |
|
| 10 | * @author Ibrahim Hizeoui <[email protected]> |
|
| 11 | */ |
|
| 12 | class AutomaticReminder implements CreatableFromArray |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * var int. |
|
| 16 | */ |
|
| 17 | private $delayDays; |
|
| 18 | ||
| 19 | /** |
|
| 20 | * var string. |
|
| 21 | */ |
|
| 22 | private $message; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * @return int |
|
| 26 | */ |
|
| 27 | public function getDelayDays() |
|
| 28 | { |
|
| 29 | return $this->delayDays; |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * @param $delayDays |
|
| 34 | * |
|
| 35 | * @return AutomaticReminder |
|
| 36 | */ |
|
| 37 | public function withDelayDays($delayDays) |
|
| 38 | { |
|
| 39 | $new = clone $this; |
|
| 40 | $new->delayDays = $delayDays; |
|
| 41 | ||
| 42 | return $new; |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * @return string |
|
| 47 | */ |
|
| 48 | public function getMessage() |
|
| 49 | { |
|
| 50 | return $this->message; |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * @param $message |
|
| 55 | * |
|
| 56 | * @return AutomaticReminder |
|
| 57 | */ |
|
| 58 | public function withMessage($message) |
|
| 59 | { |
|
| 60 | $new = clone $this; |
|
| 61 | $new->message = $message; |
|
| 62 | ||
| 63 | return $new; |
|
| 64 | } |
|
| 65 | ||
| 66 | public function toArray() |
|
| 67 | { |
|
| 68 | $data = []; |
|
| 69 | if ($this->delayDays !== null) { |
|
| 70 | $data['delay_days'] = $this->delayDays; |
|
| 71 | } |
|
| 72 | if ($this->message !== null) { |
|
| 73 | $data['message'] = $this->message; |
|
| 74 | } |
|
| 75 | ||
| 76 | return $data; |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * Create an API response object from the HTTP response from the API server. |
|
| 81 | * |
|
| 82 | * @param array $data |
|
| 83 | * |
|
| 84 | * @return self |
|
| 85 | */ |
|
| 86 | public static function createFromArray(array $data) |
|
| 87 | { |
|
| 88 | $automaticReminders = new self(); |
|
| 89 | $automaticReminders->delayDays = $data['delay_days'] ?? null; |
|
| 90 | $automaticReminders->message = $data['message'] ?? null; |
|
| 91 | ||
| 92 | return $automaticReminders; |
|
| 93 | } |
|
| 94 | } |
|
| 95 | ||
| @@ 12-94 (lines=83) @@ | ||
| 9 | /** |
|
| 10 | * @author Ibrahim Hizeoui <[email protected]> |
|
| 11 | */ |
|
| 12 | class AutomaticReminderCollection implements CreatableFromArray |
|
| 13 | { |
|
| 14 | /** |
|
| 15 | * var int. |
|
| 16 | */ |
|
| 17 | private $delayDays; |
|
| 18 | ||
| 19 | /** |
|
| 20 | * var string. |
|
| 21 | */ |
|
| 22 | private $message; |
|
| 23 | ||
| 24 | /** |
|
| 25 | * @return int |
|
| 26 | */ |
|
| 27 | public function getDelayDays() |
|
| 28 | { |
|
| 29 | return $this->delayDays; |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * @param $delayDays |
|
| 34 | * |
|
| 35 | * @return AutomaticReminderCollection |
|
| 36 | */ |
|
| 37 | public function withDelayDays($delayDays) |
|
| 38 | { |
|
| 39 | $new = clone $this; |
|
| 40 | $new->delayDays = $delayDays; |
|
| 41 | ||
| 42 | return $new; |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * @return string |
|
| 47 | */ |
|
| 48 | public function getMessage() |
|
| 49 | { |
|
| 50 | return $this->message; |
|
| 51 | } |
|
| 52 | ||
| 53 | /** |
|
| 54 | * @param $message |
|
| 55 | * |
|
| 56 | * @return AutomaticReminderCollection |
|
| 57 | */ |
|
| 58 | public function withMessage($message) |
|
| 59 | { |
|
| 60 | $new = clone $this; |
|
| 61 | $new->message = $message; |
|
| 62 | ||
| 63 | return $new; |
|
| 64 | } |
|
| 65 | ||
| 66 | public function toArray() |
|
| 67 | { |
|
| 68 | $data = []; |
|
| 69 | if ($this->delayDays !== null) { |
|
| 70 | $data['delay_days'] = $this->delayDays; |
|
| 71 | } |
|
| 72 | if ($this->message !== null) { |
|
| 73 | $data['message'] = $this->message; |
|
| 74 | } |
|
| 75 | ||
| 76 | return $data; |
|
| 77 | } |
|
| 78 | ||
| 79 | /** |
|
| 80 | * Create an API response object from the HTTP response from the API server. |
|
| 81 | * |
|
| 82 | * @param array $data |
|
| 83 | * |
|
| 84 | * @return self |
|
| 85 | */ |
|
| 86 | public static function createFromArray(array $data) |
|
| 87 | { |
|
| 88 | $automaticReminders = new self(); |
|
| 89 | $automaticReminders->delayDays = $data['delay_days'] ?? null; |
|
| 90 | $automaticReminders->message = $data['message'] ?? null; |
|
| 91 | ||
| 92 | return $automaticReminders; |
|
| 93 | } |
|
| 94 | } |
|
| 95 | ||