| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | protected function fetchMySQLDatabases() |
||
| 16 | { |
||
| 17 | $uri = str_replace('{forgeserver}', $this->server, config('forge-publish.get_mysql_uri')); |
||
|
|
|||
| 18 | $this->url = config('forge-publish.url') . $uri; |
||
| 19 | try { |
||
| 20 | $response = $this->http->get($this->url, [ |
||
| 21 | 'headers' => [ |
||
| 22 | 'X-Requested-With' => 'XMLHttpRequest', |
||
| 23 | 'Authorization' => 'Bearer ' . fp_env('ACACHA_FORGE_ACCESS_TOKEN') |
||
| 24 | ] |
||
| 25 | ]); |
||
| 26 | } catch (\Exception $e) { |
||
| 27 | $this->error('And error occurs connecting to the api url: ' . $this->url); |
||
| 28 | $this->error('Status code: ' . $e->getResponse()->getStatusCode() . ' | Reason : ' . $e->getResponse()->getReasonPhrase()); |
||
| 29 | return []; |
||
| 30 | } |
||
| 31 | return json_decode((string) $response->getBody(), true); |
||
| 32 | } |
||
| 33 | |||
| 53 |
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: