SipgateMessage   A
last analyzed

Complexity

Total Complexity 12

Size/Duplication

Total Lines 128
Duplicated Lines 0 %

Test Coverage

Coverage 93.75%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 25
dl 0
loc 128
ccs 30
cts 32
cp 0.9375
rs 10
c 1
b 0
f 1
wmc 12

12 Methods

Rating   Name   Duplication   Size   Complexity  
A getSendAt() 0 3 1
A getSmsId() 0 3 1
A toArray() 0 7 1
A smsId() 0 5 1
A sendAt() 0 5 1
A __construct() 0 3 1
A recipient() 0 5 1
A getMessage() 0 3 1
A jsonSerialize() 0 3 1
A create() 0 3 1
A getRecipient() 0 3 1
A message() 0 5 1
1
<?php
2
3
namespace NotificationChannels\Sipgate;
4
5
use Illuminate\Contracts\Support\Arrayable;
6
use JsonSerializable;
7
8
class SipgateMessage implements Arrayable, JsonSerializable
9
{
10
    /** @var string */
11
    protected $message;
12
13
    /** @var string */
14
    protected $recipient;
15
16
    /** @var string */
17
    protected $smsId;
18
19
    /** @var int */
20
    protected $sendAt;
21
22
    /**
23
     * SipgateMessage constructor.
24
     * @param  string  $message
25
     */
26 19
    public function __construct(string $message = '')
27
    {
28 19
        $this->message = $message;
29 19
    }
30
31
    /**
32
     * @param  string  $message
33
     * @return static
34
     */
35 8
    public static function create(string $message = '')
36
    {
37 8
        return new static($message);
38
    }
39
40
    /**
41
     * @return string
42
     */
43 7
    public function getSmsId()
44
    {
45 7
        return $this->smsId;
46
    }
47
48
    /**
49
     * @param  string  $smsId
50
     *
51
     * @return SipgateMessage
52
     */
53 10
    public function smsId(string $smsId)
54
    {
55 10
        $this->smsId = $smsId;
56
57 10
        return $this;
58
    }
59
60
    /**
61
     * @return string
62
     */
63 3
    public function getMessage()
64
    {
65 3
        return $this->message;
66
    }
67
68
    /**
69
     * @param  string  $message
70
     * @return SipgateMessage
71
     */
72 4
    public function message(string $message)
73
    {
74 4
        $this->message = $message;
75
76 4
        return $this;
77
    }
78
79
    /**
80
     * @return string
81
     */
82 8
    public function getRecipient()
83
    {
84 8
        return $this->recipient;
85
    }
86
87
    /**
88
     * @param  string  $recipient
89
     * @return SipgateMessage
90
     */
91 10
    public function recipient(string $recipient)
92
    {
93 10
        $this->recipient = $recipient;
94
95 10
        return $this;
96
    }
97
98
    /**
99
     * @return int | null
100
     */
101 1
    public function getSendAt()
102
    {
103 1
        return $this->sendAt;
104
    }
105
106
    /**
107
     * @param  int  $sendAt
108
     * @return SipgateMessage
109
     */
110 4
    public function sendAt($sendAt)
111
    {
112 4
        $this->sendAt = $sendAt;
113
114 4
        return $this;
115
    }
116
117
    /**
118
     * @return array
119
     */
120 1
    public function toArray()
121
    {
122
        return [
123 1
            'message' => $this->message,
124 1
            'recipient' => $this->recipient,
125 1
            'smsId' => $this->smsId,
126 1
            'sendAt' => $this->sendAt,
127
        ];
128
    }
129
130
    /**
131
     * @return array
132
     */
133
    public function jsonSerialize()
134
    {
135
        return $this->toArray();
136
    }
137
}
138