| @@ -50,10 +50,11 @@ discard block | ||
| 50 | 50 | */ | 
| 51 | 51 | public function send() | 
| 52 | 52 |      { | 
| 53 | - if ($this->method == 'pattern') | |
| 54 | - $res = $this->sendPattern(); | |
| 55 | - else | |
| 56 | - $res = $this->message($this->text); | |
| 53 | +        if ($this->method == 'pattern') { | |
| 54 | + $res = $this->sendPattern(); | |
| 55 | +        } else { | |
| 56 | + $res = $this->message($this->text); | |
| 57 | + } | |
| 57 | 58 | return $res; | 
| 58 | 59 | } | 
| 59 | 60 | |
| @@ -75,8 +76,9 @@ discard block | ||
| 75 | 76 | public function pattern($pattern_code = null) | 
| 76 | 77 |      { | 
| 77 | 78 | $this->method = 'pattern'; | 
| 78 | - if ($pattern_code) | |
| 79 | - $this->pattern_code = $pattern_code; | |
| 79 | +        if ($pattern_code) { | |
| 80 | + $this->pattern_code = $pattern_code; | |
| 81 | + } | |
| 80 | 82 | return $this; | 
| 81 | 83 | } | 
| 82 | 84 | |
| @@ -165,10 +167,12 @@ discard block | ||
| 165 | 167 | |
| 166 | 168 | private function validateData($parameters) | 
| 167 | 169 |      { | 
| 168 | - if (is_null($parameters)) | |
| 169 | -            throw new \Exception('The data must be set'); | |
| 170 | - if (count($parameters) > 1) | |
| 171 | -            throw new \Exception('The data must have just one OTP code'); | |
| 170 | +        if (is_null($parameters)) { | |
| 171 | +                    throw new \Exception('The data must be set'); | |
| 172 | + } | |
| 173 | +        if (count($parameters) > 1) { | |
| 174 | +                    throw new \Exception('The data must have just one OTP code'); | |
| 175 | + } | |
| 172 | 176 | } | 
| 173 | 177 | |
| 174 | 178 | /** | 
| @@ -178,24 +182,29 @@ discard block | ||
| 178 | 182 | */ | 
| 179 | 183 | private function validateMobile($mobile) | 
| 180 | 184 |      { | 
| 181 | - if (empty($mobile)) | |
| 182 | -            throw new \Exception('The mobile number must be set'); | |
| 183 | - if (count($mobile) > 1) | |
| 184 | -            throw new \Exception('The OTP code must send to just one mobile number'); | |
| 185 | +        if (empty($mobile)) { | |
| 186 | +                    throw new \Exception('The mobile number must be set'); | |
| 187 | + } | |
| 188 | +        if (count($mobile) > 1) { | |
| 189 | +                    throw new \Exception('The OTP code must send to just one mobile number'); | |
| 190 | + } | |
| 185 | 191 | } | 
| 186 | 192 | |
| 187 | 193 | private function validateTemplateId($templateId) | 
| 188 | 194 |      { | 
| 189 | - if (is_null($templateId)) | |
| 190 | -            throw new \Exception('The templateId must be set'); | |
| 195 | +        if (is_null($templateId)) { | |
| 196 | +                    throw new \Exception('The templateId must be set'); | |
| 197 | + } | |
| 191 | 198 | } | 
| 192 | 199 | |
| 193 | 200 | private function validateParameterStructure($param) | 
| 194 | 201 |      { | 
| 195 | - if (!isset($param['name'])) | |
| 196 | -            throw new \Exception('The `name` parameter not defined in data'); | |
| 197 | - if (!isset($param['value'])) | |
| 198 | -            throw new \Exception('The `value` parameter not defined in data'); | |
| 202 | +        if (!isset($param['name'])) { | |
| 203 | +                    throw new \Exception('The `name` parameter not defined in data'); | |
| 204 | + } | |
| 205 | +        if (!isset($param['value'])) { | |
| 206 | +                    throw new \Exception('The `value` parameter not defined in data'); | |
| 207 | + } | |
| 199 | 208 | } | 
| 200 | 209 | |
| 201 | 210 | /** | 
| @@ -208,8 +217,9 @@ discard block | ||
| 208 | 217 |              if (is_null($inputs['parameters'][0]['value'])) { | 
| 209 | 218 | $inputs['parameters'][0]['value'] = rand(100000, 999999); | 
| 210 | 219 | } | 
| 211 | - } else | |
| 212 | - $inputs['parameters'][0]['value'] = $pattern_code; | |
| 220 | +        } else { | |
| 221 | + $inputs['parameters'][0]['value'] = $pattern_code; | |
| 222 | + } | |
| 213 | 223 | |
| 214 | 224 | } | 
| 215 | 225 | |
| @@ -244,19 +254,23 @@ discard block | ||
| 244 | 254 | private function setMessageExceptions() | 
| 245 | 255 |      { | 
| 246 | 256 |          $apiKey = config('sms.drivers.' . $this->drive . '.apiKey'); | 
| 247 | - if ($apiKey == '') | |
| 248 | -            throw new \Exception('The apiKey of SMS.ir muse be set in config'); | |
| 257 | +        if ($apiKey == '') { | |
| 258 | +                    throw new \Exception('The apiKey of SMS.ir muse be set in config'); | |
| 259 | + } | |
| 249 | 260 | |
| 250 | 261 |          $this->url = config('sms.drivers.' . $this->drive . '.urlNormal'); | 
| 251 | - if ($this->url == '') | |
| 252 | -            throw new \Exception('The url of SMS.ir muse be set in config'); | |
| 262 | +        if ($this->url == '') { | |
| 263 | +                    throw new \Exception('The url of SMS.ir muse be set in config'); | |
| 264 | + } | |
| 253 | 265 | |
| 254 | 266 | $numbers = $this->numbers; | 
| 255 | - if (count($numbers) < 1) | |
| 256 | -            throw new \Exception('The numbers of mobiles must be set'); | |
| 267 | +        if (count($numbers) < 1) { | |
| 268 | +                    throw new \Exception('The numbers of mobiles must be set'); | |
| 269 | + } | |
| 257 | 270 | |
| 258 | - if ($this->from == '') | |
| 259 | -            throw new \Exception('The lineNumber of SMS.ir muse be set in config (set it in `from` key)'); | |
| 271 | +        if ($this->from == '') { | |
| 272 | +                    throw new \Exception('The lineNumber of SMS.ir muse be set in config (set it in `from` key)'); | |
| 273 | + } | |
| 260 | 274 | |
| 261 | 275 |          return compact('apiKey', 'numbers'); | 
| 262 | 276 | } |