SmsIn::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Ittoolspl\Smslabs\VO;
5
6
class SmsIn
7
{
8
    /**
9
     * @var string
10
     */
11
    private $id;
12
13
    /**
14
     * @var int
15
     */
16
    private $count;
17
18
    /**
19
     * @var string
20
     */
21
    private $content;
22
23
    /**
24
     * @var string
25
     */
26
    private $numberTo;
27
28
    /**
29
     * @var \DateTime
30
     */
31
    private $receiveTime;
32
33
    /**
34
     * @var string
35
     */
36
    private $numberFrom;
37
38
    /**
39
     * @var int
40
     */
41
    private $status;
42
43
    /**
44
     * SmsIn constructor.
45
     * @param string $id
46
     * @param int $count
47
     * @param string $content
48
     * @param string $numberTo
49
     * @param int $receiveTime
50
     * @param string $numberFrom
51
     * @param int $status
52
     */
53 2
    public function __construct(
54
        string $id,
55
        int $count,
56
        string $content,
57
        string $numberTo,
58
        int $receiveTime,
59
        string $numberFrom,
60
        int $status
61
    ) {
62 2
        $receiveTimeDT = new \DateTime();
63 2
        $receiveTimeDT->setTimestamp($receiveTime);
64
65 2
        $this->id          = $id;
66 2
        $this->count       = $count;
67 2
        $this->content     = $content;
68 2
        $this->numberTo    = $numberTo;
69 2
        $this->receiveTime = $receiveTimeDT;
70 2
        $this->numberFrom  = $numberFrom;
71 2
        $this->status      = $status;
72 2
    }
73
74
    /**
75
     * @param array $response
76
     * @return SmsIn
77
     */
78 2
    public static function createFromResponseArray(array $response) : SmsIn
79
    {
80 2
        return new self(
81 2
            $response['_id'],
82 2
            $response['s_cnt'],
83 2
            $response['s_con'],
84 2
            $response['no_to'],
85 2
            $response['in_t'],
86 2
            $response['no_fr'],
87 2
            $response['stat']
88
        );
89
    }
90
91
    /**
92
     * @return string
93
     */
94 2
    public function getId() : string
95
    {
96 2
        return $this->id;
97
    }
98
99
    /**
100
     * @return int
101
     */
102 1
    public function getCount() : int
103
    {
104 1
        return $this->count;
105
    }
106
107
    /**
108
     * @return string
109
     */
110 2
    public function getContent() : string
111
    {
112 2
        return $this->content;
113
    }
114
115
    /**
116
     * @return string
117
     */
118 1
    public function getNumberTo() : string
119
    {
120 1
        return $this->numberTo;
121
    }
122
123
    /**
124
     * @return \DateTime
125
     */
126 1
    public function getReceiveTime() : \DateTime
127
    {
128 1
        return $this->receiveTime;
129
    }
130
131
    /**
132
     * @return string
133
     */
134 1
    public function getNumberFrom() : string
135
    {
136 1
        return $this->numberFrom;
137
    }
138
139
    /**
140
     * @return int
141
     */
142 1
    public function getStatus() : int
143
    {
144 1
        return $this->status;
145
    }
146
}
147