| Total Complexity | 3 |
| Total Lines | 58 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | abstract class ResourceCommand extends ApiCommand |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Resource path. |
||
| 12 | * |
||
| 13 | * @return string |
||
| 14 | */ |
||
| 15 | abstract public function resourcePath(); |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Resource class name. |
||
| 19 | * |
||
| 20 | * @return string |
||
| 21 | */ |
||
| 22 | abstract public function resourceClass(); |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Handle command response. |
||
| 26 | * |
||
| 27 | * @param ResponseInterface $response |
||
| 28 | * @param ApiResourceInterface $owner |
||
| 29 | * |
||
| 30 | * @return mixed |
||
| 31 | */ |
||
| 32 | abstract public function handleResponse(ResponseInterface $response, ApiResourceInterface $owner); |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Determines if current command is list command. |
||
| 36 | * |
||
| 37 | * @return bool |
||
| 38 | */ |
||
| 39 | protected function isListCommand(): bool |
||
| 40 | { |
||
| 41 | return false; |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * Command name. |
||
| 46 | * |
||
| 47 | * @return string |
||
| 48 | */ |
||
| 49 | public function command() |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * HTTP request URL. |
||
| 56 | * |
||
| 57 | * @param ApiResourceInterface $resource |
||
| 58 | * |
||
| 59 | * @return string |
||
| 60 | */ |
||
| 61 | public function requestUrl(ApiResourceInterface $resource) |
||
| 66 | } |
||
| 67 | } |
||
| 68 |