Completed
Branch master (7c4a20)
by Vincent
15:22 queued 05:09
created

Response::getDescription()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 9
rs 9.6666
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
/**
3
 * BongaTech SMS Client Library for PHP.
4
 *
5
 * @copyright Copyright (c) 2017
6
 * @author   Vincent Mosoti <[email protected]>
7
 * @licence https://github.com/VMosoti/bongatech-sms/blob/master/LICENSE
8
 */
9
10
namespace VMosoti\BongaTech;
11
12
/**
13
 * Class Response
14
 */
15
class Response
16
{
17
    /**
18
     * the response.
19
     *
20
     * @var array
21
     */
22
    protected $response;
23
24
    /**
25
     * Response constructor.
26
     * @param array response
27
     */
28
    public function __construct($response)
29
    {
30
        $this->response = $response;
31
    }
32
33
    /**
34
     * @return mixed
35
     */
36
    public function getCode()
37
    {
38
        if (!empty($this->response->ResponseCode)) {
39
40
            return $this->response->ResponseCode;
41
        }
42
43
        return null;
44
    }
45
46
    /**
47
     * @return mixed
48
     */
49
    public function getBalance()
50
    {
51
        if (!empty($this->response->Balance)) {
52
53
            return $this->response->Balance;
54
        }
55
56
        return null;
57
    }
58
59
    /**
60
     * @return mixed
61
     */
62
    public function getDescription()
63
    {
64
        if (!empty($this->response->ResponseDescription)) {
65
66
            return $this->response->ResponseDescription;
67
        }
68
69
        return null;
70
    }
71
72
    /**
73
     * @return mixed
74
     */
75
    public function getMSISDN()
76
    {
77
        if (!empty($this->response->MSISDN)) {
78
79
            return $this->response->MSISDN;
80
        }
81
82
        return null;
83
    }
84
85
86
    /**
87
     * @return mixed
88
     */
89
    public function getCorrelator()
90
    {
91
        if (!empty($this->response->Correlator)) {
92
            return $this->response->Correlator;
93
        }
94
        return null;
95
    }
96
97
    /**
98
     * @return mixed
99
     */
100
    public function getMessageID()
101
    {
102
        if (!empty($this->response->MessageID)) {
103
104
            return $this->response->MessageID;
105
        }
106
107
        return null;
108
    }
109
110
    /**
111
     * @return mixed
112
     */
113
    public function getSourceID()
114
    {
115
        return $this->response['MessageID'];
116
    }
117
118
119
}
120