Conditions | 3 |
Paths | 3 |
Total Lines | 12 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 4 |
CRAP Score | 3.7085 |
Changes | 0 |
1 | <?php |
||
47 | 1 | public function getErrors() |
|
48 | { |
||
49 | 1 | if ($this->isSuccess()) { |
|
50 | return []; |
||
51 | } |
||
52 | 1 | if (!empty($this->body['errors'])) { |
|
53 | return array_map(function ($rec) { |
||
54 | return new Error($rec['message'], $rec['code']); |
||
55 | }, $this->body['errors']); |
||
56 | } else { |
||
57 | return [ |
||
58 | 1 | new Error($this->getHttpMessage(), $this->getStatusCode()), |
|
59 | ]; |
||
63 |