Completed
Push — master ( b82189...cfb751 )
by Janusz
02:03
created

SmsIn::createFromResponseObject()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

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