| Conditions | 4 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 11 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 53 | 39 | public function getRequest(Array $headers = [], $body = '') |
|
| 54 | { |
||
| 55 | 39 | if ($this->id === null) { |
|
| 56 | 18 | throw new RuntimeException('You must provide the Droplet ID you want to perform an action on'); |
|
| 57 | } |
||
| 58 | |||
| 59 | 21 | if (method_exists($this, 'getBody') && $body === '') { |
|
| 60 | 20 | $body = $this->getBody(); |
|
| 61 | } |
||
| 62 | |||
| 63 | 21 | $endpoint = str_replace('[:id:]', $this->id, self::ENDPOINT); |
|
| 64 | |||
| 65 | 21 | return new Request( |
|
| 66 | 21 | static::METHOD, |
|
| 67 | 21 | $endpoint, |
|
| 68 | 21 | $headers, |
|
| 69 | 21 | $body |
|
| 70 | ); |
||
| 73 |