@@ -32,10 +32,10 @@ |
||
| 32 | 32 | |
| 33 | 33 | public function __construct() |
| 34 | 34 | { |
| 35 | - $this->username = config('sms.drivers.' . $this->drive . '.username'); |
|
| 36 | - $this->password = config('sms.drivers.' . $this->drive . '.password'); |
|
| 37 | - $this->from = config('sms.drivers.' . $this->drive . '.from'); |
|
| 38 | - $this->urlٔNormal = config('sms.drivers.'.$this->drive.'.urlNormal'); |
|
| 35 | + $this->username = config('sms.drivers.'.$this->drive.'.username'); |
|
| 36 | + $this->password = config('sms.drivers.'.$this->drive.'.password'); |
|
| 37 | + $this->from = config('sms.drivers.'.$this->drive.'.from'); |
|
| 38 | + $this->urlٔNormal = config('sms.drivers.'.$this->drive.'.urlNormal'); |
|
| 39 | 39 | $this->urlPattern = config('sms.drivers.'.$this->drive.'.urlPattern'); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -56,8 +56,9 @@ discard block |
||
| 56 | 56 | public function pattern($pattern_code = null) |
| 57 | 57 | { |
| 58 | 58 | $this->method = 'pattern'; |
| 59 | - if ($pattern_code) |
|
| 60 | - $this->pattern_code = $pattern_code; |
|
| 59 | + if ($pattern_code) { |
|
| 60 | + $this->pattern_code = $pattern_code; |
|
| 61 | + } |
|
| 61 | 62 | return $this; |
| 62 | 63 | } |
| 63 | 64 | |
@@ -146,32 +147,39 @@ discard block |
||
| 146 | 147 | |
| 147 | 148 | private function validateData($parameters) |
| 148 | 149 | { |
| 149 | - if (is_null($parameters)) |
|
| 150 | - throw new \Exception('The data must be set'); |
|
| 151 | - if (count($parameters) < 1) |
|
| 152 | - throw new \Exception('The data must have at least one item'); |
|
| 150 | + if (is_null($parameters)) { |
|
| 151 | + throw new \Exception('The data must be set'); |
|
| 152 | + } |
|
| 153 | + if (count($parameters) < 1) { |
|
| 154 | + throw new \Exception('The data must have at least one item'); |
|
| 155 | + } |
|
| 153 | 156 | } |
| 154 | 157 | |
| 155 | 158 | private function validateMobile($mobile) |
| 156 | 159 | { |
| 157 | - if (empty($mobile)) |
|
| 158 | - throw new \Exception('The mobile number must be set'); |
|
| 159 | - if (count($mobile) > 1) |
|
| 160 | - throw new \Exception('Only one number is allowed for OTP'); |
|
| 160 | + if (empty($mobile)) { |
|
| 161 | + throw new \Exception('The mobile number must be set'); |
|
| 162 | + } |
|
| 163 | + if (count($mobile) > 1) { |
|
| 164 | + throw new \Exception('Only one number is allowed for OTP'); |
|
| 165 | + } |
|
| 161 | 166 | } |
| 162 | 167 | |
| 163 | 168 | private function validateTemplateId($templateId) |
| 164 | 169 | { |
| 165 | - if (is_null($templateId)) |
|
| 166 | - throw new \Exception('The templateId must be set'); |
|
| 170 | + if (is_null($templateId)) { |
|
| 171 | + throw new \Exception('The templateId must be set'); |
|
| 172 | + } |
|
| 167 | 173 | } |
| 168 | 174 | |
| 169 | 175 | private function validateParameterStructure($param) |
| 170 | 176 | { |
| 171 | - if (!isset($param['name'])) |
|
| 172 | - throw new \Exception('The `name` parameter not defined in data'); |
|
| 173 | - if (!isset($param['value'])) |
|
| 174 | - throw new \Exception('The `value` parameter not defined in data'); |
|
| 177 | + if (!isset($param['name'])) { |
|
| 178 | + throw new \Exception('The `name` parameter not defined in data'); |
|
| 179 | + } |
|
| 180 | + if (!isset($param['value'])) { |
|
| 181 | + throw new \Exception('The `value` parameter not defined in data'); |
|
| 182 | + } |
|
| 175 | 183 | } |
| 176 | 184 | |
| 177 | 185 | private function setOTP(&$inputs) |
@@ -188,11 +196,13 @@ discard block |
||
| 188 | 196 | private function setMessageExceptions() |
| 189 | 197 | { |
| 190 | 198 | $numbers = $this->numbers; |
| 191 | - if (empty($numbers)) |
|
| 192 | - throw new \Exception('The numbers of mobiles must be set'); |
|
| 199 | + if (empty($numbers)) { |
|
| 200 | + throw new \Exception('The numbers of mobiles must be set'); |
|
| 201 | + } |
|
| 193 | 202 | |
| 194 | - if (empty($this->from)) |
|
| 195 | - throw new \Exception('The lineNumber must be set in config (set it in `from` key)'); |
|
| 203 | + if (empty($this->from)) { |
|
| 204 | + throw new \Exception('The lineNumber must be set in config (set it in `from` key)'); |
|
| 205 | + } |
|
| 196 | 206 | |
| 197 | 207 | return compact('numbers'); |
| 198 | 208 | } |