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

SmsDetails::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 7
1
<?php
2
3
namespace Ittoolspl\Smslabs\Entity;
4
5
class SmsDetails
6
{
7
    private $id;
8
    private $from;
9
    private $numberTo;
10
    private $status;
11
    private $smsCount;
12
    private $smsContent;
13
    private $priceInGrosz;
14
15
    /**
16
     * SmsDetails constructor.
17
     * @param string $id
18
     * @param string $from
19
     * @param string $numberTo
20
     * @param int $status
21
     * @param int $smsCount
22
     * @param string $smsContent
23
     * @param double $priceInGrosz
24
     */
25
    public function __construct($id, $from, $numberTo, $status, $smsCount, $smsContent, $priceInGrosz)
26
    {
27
        $this->id           = $id;
28
        $this->from         = $from;
29
        $this->numberTo     = $numberTo;
30
        $this->status       = $status;
31
        $this->smsCount     = $smsCount;
32
        $this->smsContent   = $smsContent;
33
        $this->priceInGrosz = $priceInGrosz;
34
    }
35
36
    /**
37
     * Creates SmsDetails object by array
38
     * @param \stdClass $sms
39
     * @return \Ittoolspl\Smslabs\Entity\SmsDetails
40
     */
41
    public static function createFromResponseObject(\stdClass $sms)
42
    {
43
        return new self(
44
            $sms->id,
45
            $sms->from,
46
            $sms->number_to,
47
            $sms->status,
48
            $sms->sms_count,
49
            $sms->sms_content,
50
            ($sms->price / 100)
51
        );
52
    }
53
54
    /**
55
     * @return string
56
     */
57
    public function getId()
58
    {
59
        return $this->id;
60
    }
61
62
    /**
63
     * @return string
64
     */
65
    public function getFrom()
66
    {
67
        return $this->from;
68
    }
69
70
    /**
71
     * @return string
72
     */
73
    public function getNumberTo()
74
    {
75
        return $this->numberTo;
76
    }
77
78
    /**
79
     * @return int
80
     */
81
    public function getStatus()
82
    {
83
        return $this->status;
84
    }
85
86
    /**
87
     * @return int
88
     */
89
    public function getSmsCount()
90
    {
91
        return $this->smsCount;
92
    }
93
94
    /**
95
     * @return string
96
     */
97
    public function getSmsContent()
98
    {
99
        return $this->smsContent;
100
    }
101
102
    /**
103
     * @return double
104
     */
105
    public function getPriceInGrosz()
106
    {
107
        return $this->priceInGrosz;
108
    }
109
}
110