for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace VictorAvelar\Fixer\Endpoints;
use VictorAvelar\Fixer\Contracts\ExecutorInterface;
use VictorAvelar\Fixer\FixerHttpClient;
abstract class AbstractEndpoint implements ExecutorInterface
{
/**
* Execution method.
*/
const REQUEST_METHOD = "GET";
* @var FixerHttpClient
protected $client;
* @var string
protected $path = "";
* AbstractEndpoint constructor.
*
* @param FixerHttpClient $client
public function __construct(FixerHttpClient $client)
$this->client = $client;
}
* Builds the correct URI to perform requests.
* @param array $params
* @return string
public function buildURI(array $params = []): string
return join('?', [$this->path, $this->attachQueryParams($params)]);
* {@inheritdoc}
public function execute()
return $this->client->request(
self::REQUEST_METHOD,
$this->path
);
* Attach query params to the request.
private function attachQueryParams(array $params = []): string
return http_build_query(array_merge($params, [
FixerHttpClient::KEY_NAME => $this->client->getClientKey()
]));