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

SmsIn::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 11
CRAP Score 1

Importance

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