Completed
Push — master ( 84b0d6...bfba9a )
by Janusz
02:28 queued 36s
created

SmsOut   A

Complexity

Total Complexity 14

Size/Duplication

Total Lines 158
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 14
lcom 0
cbo 0
dl 0
loc 158
ccs 51
cts 51
cp 1
rs 10
c 0
b 0
f 0

12 Methods

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 31 2
A createFromResponseArray() 0 15 2
A getId() 0 4 1
A getDeliveryTime() 0 4 1
A getCount() 0 4 1
A getPrice() 0 4 1
A getContent() 0 4 1
A getNumberTo() 0 4 1
A getIncomingTime() 0 4 1
A getStatus() 0 4 1
A getStatusD() 0 4 1
A getNumberFrom() 0 4 1
1
<?php
2
3
namespace Ittoolspl\Smslabs\Entity;
4
5
class SmsOut
6
{
7
    private $id;
8
    private $deliveryTime;
9
    private $count;
10
    private $price;
11
    private $content;
12
    private $numberTo;
13
    private $incomingTime;
14
    private $status;
15
    private $statusD;
16
    private $numberFrom;
17
18
    /**
19
     * SmsOut constructor.
20
     * @param string $id
21
     * @param int $deliveryTime
22
     * @param int $count
23
     * @param double $price
24
     * @param string $content
25
     * @param string $numberTo
26
     * @param int $incomingTime
27
     * @param int $status
28
     * @param string $statusD
29
     * @param string $numberFrom
30
     */
31 1
    public function __construct(
32
        $id,
33
        $deliveryTime,
34
        $count,
35
        $price,
36
        $content,
37
        $numberTo,
38
        $incomingTime,
39
        $status,
40
        $statusD,
41
        $numberFrom
42
    ) {
43 1
        if ($deliveryTime !== null) {
44 1
            $deliveryTimeDT = new \DateTime();
45 1
            $deliveryTimeDT->setTimestamp($deliveryTime);
46 1
            $this->deliveryTime = $deliveryTimeDT;
47 1
        }
48
49 1
        $incomingTimeDT = new \DateTime();
50 1
        $incomingTimeDT->setTimestamp($incomingTime);
51 1
        $this->incomingTime = $incomingTimeDT;
52
53 1
        $this->id         = $id;
54 1
        $this->count      = $count;
55 1
        $this->price      = $price;
56 1
        $this->content    = $content;
57 1
        $this->numberTo   = $numberTo;
58 1
        $this->status     = $status;
59 1
        $this->statusD    = $statusD;
60 1
        $this->numberFrom = $numberFrom;
61 1
    }
62
63
    /**
64
     * @param array $response
65
     * @return SmsOut
66
     */
67 1
    public static function createFromResponseArray(array $response)
68
    {
69 1
        return new self(
70 1
            $response['_id'],
71 1
            array_key_exists('del_t', $response) ? $response['del_t'] : null,
72 1
            $response['s_cnt'],
73 1
            $response['price'],
74 1
            $response['s_con'],
75 1
            $response['no_to'],
76 1
            $response['in_t'],
77 1
            $response['stat'],
78 1
            $response['stat_d'],
79 1
            $response['no_fr']
80 1
        );
81
    }
82
83
    /**
84
     * @return string
85
     */
86 1
    public function getId()
87
    {
88 1
        return $this->id;
89
    }
90
91
    /**
92
     * @return \DateTime
93
     */
94 1
    public function getDeliveryTime()
95
    {
96 1
        return $this->deliveryTime;
97
    }
98
99
    /**
100
     * @return int
101
     */
102 1
    public function getCount()
103
    {
104 1
        return $this->count;
105
    }
106
107
    /**
108
     * @return double
109
     */
110 1
    public function getPrice()
111
    {
112 1
        return $this->price;
113
    }
114
115
    /**
116
     * @return string
117
     */
118 1
    public function getContent()
119
    {
120 1
        return $this->content;
121
    }
122
123
    /**
124
     * @return string
125
     */
126 1
    public function getNumberTo()
127
    {
128 1
        return $this->numberTo;
129
    }
130
131
    /**
132
     * @return \DateTime
133
     */
134 1
    public function getIncomingTime()
135
    {
136 1
        return $this->incomingTime;
137
    }
138
139
    /**
140
     * @return int
141
     */
142 1
    public function getStatus()
143
    {
144 1
        return $this->status;
145
    }
146
147
    /**
148
     * @return string
149
     */
150 1
    public function getStatusD()
151
    {
152 1
        return $this->statusD;
153
    }
154
155
    /**
156
     * @return string
157
     */
158 1
    public function getNumberFrom()
159
    {
160 1
        return $this->numberFrom;
161
    }
162
}
163