| Conditions | 2 |
| Paths | 2 |
| Total Lines | 11 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | protected function showErrorAndDie(\Exception $e) |
||
| 18 | { |
||
| 19 | $this->error('And error occurs connecting to the api url: ' . $this->url); |
||
| 20 | if ($e->getResponse()) { |
||
| 21 | $this->error('Status code: ' . $e->getResponse()->getStatusCode() . ' | Reason : ' . $e->getResponse()->getReasonPhrase()); |
||
| 22 | } else { |
||
| 23 | $this->error('Exception occurs. Message: ' . $e->getMessage()); |
||
| 24 | } |
||
| 25 | |||
| 26 | die(); |
||
| 27 | } |
||
| 28 | } |
||
| 29 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: