Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 12 |
Changes | 0 |
1 | <?php |
||
21 | public function getAccountsArray() |
||
22 | { |
||
23 | $accounts = $this->findSegments(static::SEG_ACCOUNT_INFORMATION); |
||
24 | |||
25 | foreach ($accounts as $account) { |
||
|
|||
26 | $accountParts = $this->splitSegment($account); |
||
27 | $account = $this->createModelFromArray($accountParts); |
||
28 | if ($account !== null) { |
||
29 | $this->accounts[] = $account; |
||
30 | } |
||
31 | } |
||
32 | |||
33 | return $this->accounts; |
||
34 | } |
||
35 | |||
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.