Completed
Push — master ( 533e78...e97401 )
by Janusz
02:11
created

SmsIn   A

Complexity

Total Complexity 9

Size/Duplication

Total Lines 141
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 9
c 0
b 0
f 0
lcom 0
cbo 0
dl 0
loc 141
rs 10

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 20 1
A createFromResponseArray() 0 12 1
A getId() 0 4 1
A getCount() 0 4 1
A getContent() 0 4 1
A getNumberTo() 0 4 1
A getReceiveTime() 0 4 1
A getNumberFrom() 0 4 1
A getStatus() 0 4 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
    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
        $receiveTimeDT = new \DateTime();
63
        $receiveTimeDT->setTimestamp($receiveTime);
64
65
        $this->id          = $id;
66
        $this->count       = $count;
67
        $this->content     = $content;
68
        $this->numberTo    = $numberTo;
69
        $this->receiveTime = $receiveTimeDT;
70
        $this->numberFrom  = $numberFrom;
71
        $this->status      = $status;
72
    }
73
74
    /**
75
     * @param array $response
76
     * @return SmsIn
77
     */
78
    public static function createFromResponseArray(array $response) : SmsIn
79
    {
80
        return new self(
81
            $response['_id'],
82
            $response['s_cnt'],
83
            $response['s_con'],
84
            $response['no_to'],
85
            $response['in_t'],
86
            $response['no_fr'],
87
            $response['stat']
88
        );
89
    }
90
91
    /**
92
     * @return string
93
     */
94
    public function getId() : string
95
    {
96
        return $this->id;
97
    }
98
99
    /**
100
     * @return int
101
     */
102
    public function getCount() : int
103
    {
104
        return $this->count;
105
    }
106
107
    /**
108
     * @return string
109
     */
110
    public function getContent() : string
111
    {
112
        return $this->content;
113
    }
114
115
    /**
116
     * @return string
117
     */
118
    public function getNumberTo() : string
119
    {
120
        return $this->numberTo;
121
    }
122
123
    /**
124
     * @return \DateTime
125
     */
126
    public function getReceiveTime() : \DateTime
127
    {
128
        return $this->receiveTime;
129
    }
130
131
    /**
132
     * @return string
133
     */
134
    public function getNumberFrom() : string
135
    {
136
        return $this->numberFrom;
137
    }
138
139
    /**
140
     * @return int
141
     */
142
    public function getStatus() : int
143
    {
144
        return $this->status;
145
    }
146
}
147