SmsirMessage::setMethod()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 2
c 1
b 0
f 1
dl 0
loc 5
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Rezahmady\Smsir;
4
5
use Illuminate\Support\Arr;
6
use Illuminate\Support\Facades\Log;
7
use Rezahmady\Smsir\Facades\Smsir;
8
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);
0 ignored issues
show
Bug introduced by
The method ultraFastSend() does not exist on Rezahmady\Smsir\Facades\Smsir. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

28
                    return Smsir::/** @scrutinizer ignore-call */ ultraFastSend($this->parameters, $this->templateId, $this->to);
Loading history...
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);
0 ignored issues
show
Bug introduced by
The method sendVerificationCode() does not exist on Rezahmady\Smsir\Facades\Smsir. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

35
                    return Smsir::/** @scrutinizer ignore-call */ sendVerificationCode($this->code, $this->to);
Loading history...
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)
76
    {
77
        $this->mobileNumber = $mobileNumber;
78
        
79
        return $this;
80
    }
81
82
    public function setTo($to)
83
    {
84
        $this->to = $to;
85
        
86
        return $this;
87
    }
88
}
89