for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Zurbaev\ApiClient\Commands;
use Zurbaev\ApiClient\Contracts\ApiResourceInterface;
use Psr\Http\Message\ResponseInterface;
abstract class ResourceCommand extends ApiCommand
{
/**
* Resource path.
*
* @return string
*/
abstract public function resourcePath();
* Resource class name.
abstract public function resourceClass();
* Handle command response.
* @param ResponseInterface $response
* @param ApiResourceInterface $owner
* @return mixed
abstract public function handleResponse(ResponseInterface $response, ApiResourceInterface $owner);
* Determines if current command is list command.
* @return bool
protected function isListCommand(): bool
return false;
}
* Command name.
public function command()
return $this->resourcePath();
* HTTP request URL.
* @param ApiResourceInterface $resource
public function requestUrl(ApiResourceInterface $resource)
$resourcePath = $this->resourcePath();
return $resource->apiUrl($resourcePath);