1 | <?php |
||
11 | class GetSaldo extends Response |
||
12 | { |
||
13 | const SEG_ACCOUNT_INFORMATION = 'HISAL'; |
||
14 | const SALDO_DEBIT = 'D'; |
||
15 | const SALDO_CREDIT = 'C'; |
||
16 | |||
17 | /** |
||
18 | * Creates a Saldo object from response body. |
||
19 | * |
||
20 | * @return Saldo|null |
||
21 | * @throws \Exception |
||
22 | */ |
||
23 | public function getSaldoModel() |
||
24 | { |
||
25 | $model = null; |
||
26 | $saldoSec = $this->findSegment(static::SEG_ACCOUNT_INFORMATION); |
||
27 | |||
28 | if (is_string($saldoSec)) { |
||
29 | $saldoSec = $this->splitSegment($saldoSec); |
||
30 | array_shift($saldoSec); // get rid of header |
||
31 | $model = $this->createModelFromArray($saldoSec); |
||
32 | } |
||
33 | |||
34 | return $model; |
||
35 | } |
||
36 | |||
37 | /** |
||
38 | * Creates a Saldo model from array. |
||
39 | * |
||
40 | * @param array $array |
||
41 | * @return Saldo |
||
42 | * @throws \Exception |
||
43 | */ |
||
44 | protected function createModelFromArray(array $array) |
||
70 | } |
||
71 |