SmsDetails::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 17
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 17
ccs 9
cts 9
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 15
nc 1
nop 7
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Ittoolspl\Smslabs\VO;
5
6
class SmsDetails
7
{
8
    /**
9
     * @var string
10
     */
11
    private $id;
12
13
    /**
14
     * @var string
15
     */
16
    private $from;
17
18
    /**
19
     * @var string
20
     */
21
    private $numberTo;
22
23
    /**
24
     * @var int
25
     */
26
    private $status;
27
28
    /**
29
     * @var int
30
     */
31
    private $smsCount;
32
33
    /**
34
     * @var string
35
     */
36
    private $smsContent;
37
38
    /**
39
     * @var float
40
     */
41
    private $priceInGrosz;
42
43
    /**
44
     * SmsDetails constructor.
45
     * @param string $id
46
     * @param string $from
47
     * @param string $numberTo
48
     * @param int $status
49
     * @param int $smsCount
50
     * @param string $smsContent
51
     * @param float $priceInGrosz
52
     */
53 2
    public function __construct(
54
        string $id,
55
        string $from,
56
        string $numberTo,
57
        int $status,
58
        int $smsCount,
59
        string$smsContent,
60
        float $priceInGrosz
61
    ) {
62 2
        $this->id           = $id;
63 2
        $this->from         = $from;
64 2
        $this->numberTo     = $numberTo;
65 2
        $this->status       = $status;
66 2
        $this->smsCount     = $smsCount;
67 2
        $this->smsContent   = $smsContent;
68 2
        $this->priceInGrosz = $priceInGrosz;
69 2
    }
70
71
    /**
72
     * Creates SmsDetails object by array
73
     * @param array $response
74
     * @return SmsDetails
75
     */
76 2
    public static function createFromResponseArray(array $response) : SmsDetails
77
    {
78 2
        return new self(
79 2
            $response['id'],
80 2
            $response['from'],
81 2
            $response['number_to'],
82 2
            $response['status'],
83 2
            $response['sms_count'],
84 2
            $response['sms_content'],
85 2
            ($response['price'] / 100)
86
        );
87
    }
88
89
    /**
90
     * @return string
91
     */
92 2
    public function getId() : string
93
    {
94 2
        return $this->id;
95
    }
96
97
    /**
98
     * @return string
99
     */
100 2
    public function getFrom() : string
101
    {
102 2
        return $this->from;
103
    }
104
105
    /**
106
     * @return string
107
     */
108 1
    public function getNumberTo() : string
109
    {
110 1
        return $this->numberTo;
111
    }
112
113
    /**
114
     * @return int
115
     */
116 1
    public function getStatus() : int
117
    {
118 1
        return $this->status;
119
    }
120
121
    /**
122
     * @return int
123
     */
124 1
    public function getSmsCount() : int
125
    {
126 1
        return $this->smsCount;
127
    }
128
129
    /**
130
     * @return string
131
     */
132 1
    public function getSmsContent() : string
133
    {
134 1
        return $this->smsContent;
135
    }
136
137
    /**
138
     * @return float
139
     */
140 1
    public function getPriceInGrosz() : float
141
    {
142 1
        return $this->priceInGrosz;
143
    }
144
}
145