Completed
Push — master ( 46f89e...ea4efb )
by Janusz
09:47
created

SmsOut::getDeliveryTime()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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
    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
        if ($deliveryTime !== null) {
44
            $deliveryTimeDT = new \DateTime();
45
            $deliveryTimeDT->setTimestamp($deliveryTime);
46
            $this->deliveryTime = $deliveryTimeDT;
47
        }
48
49
        $incomingTimeDT = new \DateTime();
50
        $incomingTimeDT->setTimestamp($incomingTime);
51
        $this->incomingTime = $incomingTimeDT;
52
53
        $this->id         = $id;
54
        $this->count      = $count;
55
        $this->price      = $price;
56
        $this->content    = $content;
57
        $this->numberTo   = $numberTo;
58
        $this->status     = $status;
59
        $this->statusD    = $statusD;
60
        $this->numberFrom = $numberFrom;
61
    }
62
63
    /**
64
     * @param \stdClass $respObj
65
     * @return SmsOut
66
     */
67
    public static function createFromResponseObject(\stdClass $respObj)
68
    {
69
        return new self(
70
            $respObj->_id,
71
            property_exists($respObj, 'del_t') ? $respObj->del_t : null,
72
            $respObj->s_cnt,
73
            $respObj->price,
74
            $respObj->s_con,
75
            $respObj->no_to,
76
            $respObj->in_t,
77
            $respObj->stat,
78
            $respObj->stat_d,
79
            $respObj->no_fr
80
        );
81
    }
82
83
    /**
84
     * @return string
85
     */
86
    public function getId()
87
    {
88
        return $this->id;
89
    }
90
91
    /**
92
     * @return \DateTime
93
     */
94
    public function getDeliveryTime()
95
    {
96
        return $this->deliveryTime;
97
    }
98
99
    /**
100
     * @return int
101
     */
102
    public function getCount()
103
    {
104
        return $this->count;
105
    }
106
107
    /**
108
     * @return double
109
     */
110
    public function getPrice()
111
    {
112
        return $this->price;
113
    }
114
115
    /**
116
     * @return string
117
     */
118
    public function getContent()
119
    {
120
        return $this->content;
121
    }
122
123
    /**
124
     * @return string
125
     */
126
    public function getNumberTo()
127
    {
128
        return $this->numberTo;
129
    }
130
131
    /**
132
     * @return \DateTime
133
     */
134
    public function getIncomingTime()
135
    {
136
        return $this->incomingTime;
137
    }
138
139
    /**
140
     * @return int
141
     */
142
    public function getStatus()
143
    {
144
        return $this->status;
145
    }
146
147
    /**
148
     * @return string
149
     */
150
    public function getStatusD()
151
    {
152
        return $this->statusD;
153
    }
154
155
    /**
156
     * @return string
157
     */
158
    public function getNumberFrom()
159
    {
160
        return $this->numberFrom;
161
    }
162
}
163