| Conditions | 3 |
| Paths | 3 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function sendRequest(HttpMethod $method, string $url, string $body): Response |
||
| 15 | { |
||
| 16 | switch ($method) { |
||
| 17 | case HttpMethod::POST(): |
||
| 18 | $request = $this->post($url, $body); |
||
| 19 | break; |
||
| 20 | default: |
||
| 21 | throw new \Exception("Method not recognised"); |
||
| 22 | } |
||
| 23 | |||
| 24 | if ($this->isAuthenticated()) { |
||
| 25 | $request->addHeader("Authorization", "Bearer " . $this->token->getValue()); |
||
| 26 | } |
||
| 27 | |||
| 28 | return $request->send(); |
||
| 29 | } |
||
| 30 | |||
| 40 | } |