| Conditions | 4 |
| Paths | 4 |
| Total Lines | 24 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 19 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 37 | 4 | public function call() { |
|
| 38 | $options = [ |
||
| 39 | 'headers' => [ |
||
| 40 | 4 | 'X-Auth-Token' => $this->token, |
|
| 41 | 4 | ], |
|
| 42 | 4 | ]; |
|
| 43 | |||
| 44 | 4 | switch ($this->method) { |
|
| 45 | 4 | case 'GET': |
|
| 46 | 1 | $response = $this->guzzle->get("{$this->endpoint}{$this->resource}", $options); |
|
| 47 | 1 | break; |
|
| 48 | 3 | case 'POST': |
|
| 49 | 1 | $options['json'] = $this->parameters; |
|
| 50 | 1 | $response = $this->guzzle->post("{$this->endpoint}{$this->resource}", $options); |
|
| 51 | 1 | break; |
|
| 52 | 2 | case 'DELETE': |
|
| 53 | 1 | $response = $this->guzzle->delete("{$this->endpoint}{$this->resource}", $options); |
|
| 54 | 1 | break; |
|
| 55 | 1 | default: |
|
| 56 | 1 | throw new \RuntimeException('No valid method set'); |
|
| 57 | 4 | } |
|
| 58 | |||
| 59 | 3 | return $response->getBody()->getContents(); |
|
| 60 | } |
||
| 61 | } |
||
| 62 |