dev-think-one /
laravel-loqate-api
| 1 | <?php |
||
| 2 | |||
| 3 | |||
| 4 | namespace LaravelLoqate\Responses; |
||
| 5 | |||
| 6 | class CaptureInteractiveResponse extends AbstractResponse |
||
| 7 | { |
||
| 8 | 2 | public function items(): array |
|
| 9 | { |
||
| 10 | 2 | $items = $this->json('Items', []); |
|
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 11 | |||
| 12 | 2 | return is_array($items) ? $items : []; |
|
| 13 | } |
||
| 14 | |||
| 15 | 1 | public function failed(): bool |
|
| 16 | { |
||
| 17 | 1 | $items = $this->items(); |
|
| 18 | |||
| 19 | 1 | return (!count($items)) || !empty($items[0]['Error']); |
|
| 20 | } |
||
| 21 | |||
| 22 | 1 | public function success(): bool |
|
| 23 | { |
||
| 24 | 1 | return !$this->failed(); |
|
| 25 | } |
||
| 26 | |||
| 27 | 1 | public function errorCode(): string |
|
| 28 | { |
||
| 29 | 1 | return $this->items()[0]['Error'] ?? ''; |
|
| 30 | } |
||
| 31 | |||
| 32 | 1 | public function errorDescription(): string |
|
| 33 | { |
||
| 34 | 1 | return $this->items()[0]['Description'] ?? ''; |
|
| 35 | } |
||
| 36 | |||
| 37 | 1 | public function errorCause(): string |
|
| 38 | { |
||
| 39 | 1 | return $this->items()[0]['Cause'] ?? ''; |
|
| 40 | } |
||
| 41 | |||
| 42 | 1 | public function errorResolution(): string |
|
| 43 | { |
||
| 44 | 1 | return $this->items()[0]['Resolution'] ?? ''; |
|
| 45 | } |
||
| 46 | } |
||
| 47 |