| 1 | <?php |
||
| 11 | class GetAccounts extends Response |
||
| 12 | { |
||
| 13 | const SEG_ACCOUNT_INFORMATION = 'HIUPD'; |
||
| 14 | |||
| 15 | /** @var array */ |
||
| 16 | protected $accounts = array(); |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @return array |
||
| 20 | */ |
||
| 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 | $this->accounts[] = $this->createModelFromArray($accountParts); |
||
| 28 | } |
||
| 29 | |||
| 30 | return $this->accounts; |
||
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Creates a Account model from array. |
||
| 35 | * |
||
| 36 | * @param array $array |
||
| 37 | * @return Account |
||
| 38 | */ |
||
| 39 | protected function createModelFromArray(array $array) |
||
| 54 | } |
||
| 55 |
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.