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