Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 2 |
Changes | 2 | ||
Bugs | 1 | Features | 0 |
1 | <?php |
||
18 | 9 | public function getData() |
|
19 | { |
||
20 | 9 | $this->validate('transactionReference'); |
|
21 | |||
22 | $data = [ |
||
23 | 9 | 'opcode' => 1, |
|
24 | 9 | 'payment_id' => $this->getTransactionReference(), |
|
25 | 9 | 'token' => $this->getRequestToken(), |
|
26 | 9 | ]; |
|
27 | |||
28 | 9 | if ($this->getAmount()) { |
|
|
|||
29 | 3 | $data['amount'] = $this->getAmount(); |
|
30 | 3 | } |
|
31 | |||
32 | 9 | return $data; |
|
33 | } |
||
34 | |||
45 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: