for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace drupol\Yaroc\Plugin;
use drupol\Yaroc\Http\AbstractClient;
abstract class AbstractMethodPlugin extends AbstractClient implements MethodPluginInterface
{
/**
* The endpoint.
*
* @var string
*/
private $endpoint;
* The parameters.
* @var array
private $parameters = [];
* {@inheritdoc}
public function call()
$parameters = [
'jsonrpc' => '2.0',
'id' => uniqid($this->getMethod() . '_'),
'params' => $this->getParameters(),
'method' => $this->getMethod(),
];
$response = false;
try {
$response = $this->getHttpClient()->sendRequest(
$this->getMessageFactory()->createRequest(
'POST',
$this->getEndpoint(),
[],
json_encode(
$parameters
)
);
} catch (\Exception $exception) {
// @todo: log this.
}
return $response;
public function withEndPoint(string $endpoint)
$clone = clone $this;
$clone->endpoint = $endpoint;
return $clone;
public function getEndPoint()
return $this->endpoint;
public function withApiKey(string $apikey)
$parameters = $clone->getParameters();
$parameters += ['apiKey' => $apikey];
$clone->parameters = $parameters;
public function withParameters(array $parameters)
public function getParameters()
return $this->parameters;
public function getMethod()
return $this::METHOD;