Conditions | 2 |
Paths | 2 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
42 | protected function createModelFromArray(array $array) |
||
43 | { |
||
44 | if (!$array[1]) { |
||
45 | return null; |
||
46 | } |
||
47 | $account = new Account(); |
||
48 | list($accountNumber, $x, $countryCode, $bankCode) = explode(':', $array[1]); |
||
49 | $account->setId($array[1]); |
||
50 | $account->setAccountNumber($accountNumber); |
||
51 | $account->setBankCode($bankCode); |
||
52 | $account->setIban($array[2]); |
||
53 | $account->setCustomerId($array[3]); |
||
54 | $account->setCurrency($array[5]); |
||
55 | $account->setAccountOwnerName($array[6]); |
||
56 | $account->setAccountDescription($array[8]); |
||
57 | |||
58 | return $account; |
||
59 | } |
||
60 | } |
||
61 |
There are different options of fixing this problem.
If you want to be on the safe side, you can add an additional type-check:
If you are sure that the expression is traversable, you might want to add a doc comment cast to improve IDE auto-completion and static analysis:
Mark the issue as a false-positive: Just hover the remove button, in the top-right corner of this issue for more options.