Completed
Push — master ( cd54d5...b808c3 )
by
unknown
18s
created

Result::getReason()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Covery\Client;
4
5
/**
6
 * Class Result
7
 *
8
 * Contains decision result data, received from Covery
9
 *
10
 * @package Covery\Client
11
 */
12
class Result
13
{
14
    /**
15
     * @var int
16
     */
17
    private $requestId;
18
    /**
19
     * @var string
20
     */
21
    private $type;
22
    /**
23
     * @var int
24
     */
25
    private $createdAt;
26
    /**
27
     * @var string
28
     */
29
    private $sequenceId;
30
    /**
31
     * @var string
32
     */
33
    private $merchantUserId;
34
    /**
35
     * @var int
36
     */
37
    private $score;
38
    /**
39
     * @var bool
40
     */
41
    private $accept;
42
    /**
43
     * @var bool
44
     */
45
    private $reject;
46
    /**
47
     * @var bool
48
     */
49
    private $manual;
50
    /**
51
     * @var null|string
52
     */
53
    private $reason;
54
    /**
55
     * @var null|string
56
     */
57
    private $action;
58
    /**
59
     * @var null|array
60
     */
61
    private $customResponse;
62
63
    /**
64
     * Result constructor.
65
     *
66
     * @param int $requestId
67
     * @param string $type
68
     * @param int $createdAt
69
     * @param string $sequenceId
70
     * @param string $merchantUserId
71
     * @param int $score
72
     * @param bool $accept
73
     * @param bool $reject
74
     * @param bool $manual
75
     * @param null|string $reason
76
     * @param null|string $action
77
     * @param null|array $customResponse
78
     */
79
    public function __construct(
80
        $requestId,
81
        $type,
82
        $createdAt,
83
        $sequenceId,
84
        $merchantUserId,
85
        $score,
86
        $accept,
87
        $reject,
88
        $manual,
89
        $reason = null,
90
        $action = null,
91
        $customResponse = null
92
    ) {
93
        if (!is_int($requestId)) {
94
            throw new \InvalidArgumentException('Request ID must be integer');
95
        }
96
        if (!is_string($type)) {
97
            throw new \InvalidArgumentException('Type must be string');
98
        }
99
        if (!is_int($createdAt)) {
100
            throw new \InvalidArgumentException('Created At must be integer');
101
        }
102
        if (!is_string($sequenceId)) {
103
            throw new \InvalidArgumentException('Sequence Id must be string');
104
        }
105
        if (!is_string($merchantUserId)) {
106
            throw new \InvalidArgumentException('Merchant User Id must be string');
107
        }
108
        if (!is_int($score)) {
109
            throw new \InvalidArgumentException('Score must be integer');
110
        }
111
        if (!is_bool($accept)) {
112
            throw new \InvalidArgumentException('Accept flag must be boolean');
113
        }
114
        if (!is_bool($reject)) {
115
            throw new \InvalidArgumentException('Reject flag must be boolean');
116
        }
117
        if (!is_bool($manual)) {
118
            throw new \InvalidArgumentException('Manual flag must be boolean');
119
        }
120
        if ($reason !== null && !is_string($reason)) {
121
            throw new \InvalidArgumentException('Reason must be string');
122
        }
123
        if ($action !== null && !is_string($action)) {
124
            throw new \InvalidArgumentException('Action must be string');
125
        }
126
        if ($customResponse !== null && !is_array($customResponse)) {
127
            throw new \InvalidArgumentException('Custom Response must be array');
128
        }
129
        $this->requestId = $requestId;
130
        $this->type = $type;
131
        $this->createdAt = $createdAt;
132
        $this->sequenceId = $sequenceId;
133
        $this->merchantUserId = $merchantUserId;
134
        $this->score = $score;
135
        $this->accept = $accept;
136
        $this->reject = $reject;
137
        $this->manual = $manual;
138
        $this->reason = $reason;
139
        $this->action = $action;
140
        $this->customResponse = $customResponse;
141
    }
142
143
    /**
144
     * @return int
145
     */
146
    public function getRequestId()
147
    {
148
        return $this->requestId;
149
    }
150
151
    /**
152
     * @return string
153
     */
154
    public function getType()
155
    {
156
        return $this->type;
157
    }
158
159
    /**
160
     * @return int
161
     */
162
    public function getCreatedAt()
163
    {
164
        return $this->createdAt;
165
    }
166
167
    /**
168
     * @return string
169
     */
170
    public function getSequenceId()
171
    {
172
        return $this->sequenceId;
173
    }
174
175
    /**
176
     * @return string
177
     */
178
    public function getMerchantUserId()
179
    {
180
        return $this->merchantUserId;
181
    }
182
183
    /**
184
     * @return int
185
     */
186
    public function getScore()
187
    {
188
        return $this->score;
189
    }
190
191
    /**
192
     * @return boolean
193
     */
194
    public function isAccept()
195
    {
196
        return $this->accept;
197
    }
198
199
    /**
200
     * @return boolean
201
     */
202
    public function isReject()
203
    {
204
        return $this->reject;
205
    }
206
207
    /**
208
     * @return boolean
209
     */
210
    public function isManual()
211
    {
212
        return $this->manual;
213
    }
214
215
    /**
216
     * @return string|null
217
     */
218
    public function getReason()
219
    {
220
        return $this->reason;
221
    }
222
223
    /**
224
     * @return string|null
225
     */
226
    public function getAction()
227
    {
228
        return $this->action;
229
    }
230
231
    /**
232
     * @return array|null
233
     */
234
    public function getCustomResponse()
235
    {
236
        return $this->customResponse;
237
    }
238
}
239