for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PhpJsonRpc\Client;
use PhpJsonRpc\Common\Chain\Chain;
use PhpJsonRpc\Common\Chain\Container;
abstract class AbstractTransport implements TransportInterface
{
/**
* @var Chain
*/
protected $preRequest;
protected $postRequest;
* AbstractTransport constructor.
public function __construct()
$this->preRequest = Chain::createBase();
$this->postRequest = Chain::createBase();
}
* @return Chain
public function onPreRequest(): Chain
return $this->preRequest;
public function onPostRequest(): Chain
return $this->postRequest;
* Execute request
*
* @param string $request
* @return string
public function request(string $request): string
$request = $this->preRequest($request);
$response = $this->send($request);
return $this->postRequest($response);
abstract public function send(string $request): string;
private function preRequest(string $request): string
return $this->preRequest->handle(new Container($this, $request))->last();
* @param string $response
private function postRequest(string $response): string
return $this->postRequest->handle(new Container($this, $response))->last();