Completed
Push — master ( 868971...61fa55 )
by Vincent
05:11
created

Response::getReport()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
c 0
b 0
f 0
nc 2
nop 0
dl 0
loc 4
rs 10
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
     *
27
     * @param array response
28
     */
29
    public function __construct($response)
30
    {
31
        $this->response = $response;
32
    }
33
34
    /**
35
     * @return mixed
36
     */
37
    public function getCode()
38
    {
39
        return !empty($this->response->ResponseCode) ? $this->response->ResponseCode : '';
40
    }
41
42
    /**
43
     * @return mixed
44
     */
45
    public function getBalance()
46
    {
47
        return !empty($this->response->Balance ? $this->response->Balance : '');
48
    }
49
50
    /**
51
     * @return mixed
52
     */
53
    public function getDescription()
54
    {
55
        return !empty($this->response->ResponseDescription) ? $this->response->ResponseDescription : '';
56
    }
57
58
    /**
59
     * @return mixed
60
     */
61
    public function getMSISDN()
62
    {
63
        return !empty($this->response->MSISDN) ? $this->response->MSISDN : '';
64
    }
65
66
67
    /**
68
     * there are some inconsistencies in the names of objects returned.
69
     *
70
     * @return mixed
71
     */
72
    public function getCorrelator()
73
    {
74
        $correlator = '';
75
76
        if (!empty($this->response->Correlator)) {
77
78
            $correlator = $this->response->Correlator;
79
80
        } elseif (!empty($this->response->correlator)) {
81
82
            $correlator = $this->response->correlator;
83
84
        }
85
        return $correlator;
86
87
88
    }
89
90
    /**
91
     * there are some inconsistencies in the names of objects returned.
92
     *
93
     * @return mixed
94
     */
95
    public function getMessageID()
96
    {
97
        $msgid = '';
98
99
        if (!empty($this->response->MessageID)) {
100
101
            $msgid = $this->response->MessageID;
102
103
        } elseif (!empty($this->response->msg_id)) {
104
105
            $msgid = $this->response->msg_id;
106
107
        }
108
        return $msgid;
109
    }
110
111
    /**
112
     * @return mixed
113
     */
114
    public function getSourceID()
115
    {
116
        return !empty($this->response->source_id) ? $this->response->source_id : '';
117
    }
118
119
    /**
120
     * @return mixed
121
     */
122
    public function getReport()
123
    {
124
        return !empty($this->response->dlr_report) ? $this->response->dlr_report : '';
125
    }
126
127
128
}
129