| Total Complexity | 11 |
| Total Lines | 78 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 9 | class SmsirMessage |
||
| 10 | { |
||
| 11 | public $mobileNumber; |
||
| 12 | |||
| 13 | public $templateId; |
||
| 14 | |||
| 15 | public $parameters; |
||
| 16 | |||
| 17 | public $method; |
||
| 18 | |||
| 19 | public $code; |
||
| 20 | |||
| 21 | public $to; |
||
| 22 | |||
| 23 | public function trigger() |
||
| 24 | { |
||
| 25 | switch ($this->method) { |
||
| 26 | case 'ultraFastSend': |
||
| 27 | try { |
||
| 28 | return Smsir::ultraFastSend($this->parameters, $this->templateId, $this->to); |
||
|
|
|||
| 29 | } catch (\GuzzleHttp\Exception\GuzzleException $e) { |
||
| 30 | Log::error($e->getMessage()); |
||
| 31 | } |
||
| 32 | break; |
||
| 33 | case 'sendVerificationCode': |
||
| 34 | try { |
||
| 35 | return Smsir::sendVerificationCode($this->code, $this->to); |
||
| 36 | } catch (\GuzzleHttp\Exception\GuzzleException $e) { |
||
| 37 | Log::error($e->getMessage()); |
||
| 38 | } |
||
| 39 | break; |
||
| 40 | default: |
||
| 41 | # code... |
||
| 42 | break; |
||
| 43 | } |
||
| 44 | } |
||
| 45 | |||
| 46 | |||
| 47 | public function setMethod($method) |
||
| 48 | { |
||
| 49 | $this->method = $method; |
||
| 50 | |||
| 51 | return $this; |
||
| 52 | } |
||
| 53 | |||
| 54 | public function setTemplateId($templateId) |
||
| 55 | { |
||
| 56 | $this->templateId = $templateId; |
||
| 57 | |||
| 58 | return $this; |
||
| 59 | } |
||
| 60 | |||
| 61 | public function setParameters($parameters) |
||
| 62 | { |
||
| 63 | $this->parameters = $parameters; |
||
| 64 | |||
| 65 | return $this; |
||
| 66 | } |
||
| 67 | |||
| 68 | public function setCode($code) |
||
| 69 | { |
||
| 70 | $this->code = $code; |
||
| 71 | |||
| 72 | return $this; |
||
| 73 | } |
||
| 74 | |||
| 75 | public function setMobileNumber($mobileNumber) |
||
| 80 | } |
||
| 81 | |||
| 82 | public function setTo($to) |
||
| 83 | { |
||
| 84 | $this->to = $to; |
||
| 87 | } |
||
| 88 | } |
||
| 89 |