for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Yoanm\JsonRpcServer\Infra\RawObject;
use Yoanm\JsonRpcServer\Domain\Model\JsonRpcRequest;
use Yoanm\JsonRpcServer\Domain\Model\JsonRpcResponse;
/**
* Class JsonRpcRawRequest
*/
class JsonRpcRawRequest
{
/** @var bool */
private $isBatch;
/** @var mixed[] */
private $itemList = [];
* @param bool|false $isBatch
public function __construct(bool $isBatch = false)
$this->isBatch = $isBatch;
}
* @param JsonRpcRequest|\Exception $item
*
* @return JsonRpcRawRequest
public function addItem(object $item) : JsonRpcRawRequest
if (!$item instanceof JsonRpcResponse && !$item instanceof \Exception) {
throw new \InvalidArgumentException(
sprintf(
'item must be either an instance of %s or an instance of %s',
JsonRpcRequest::class,
\Exception::class
)
);
$this->itemList[] = $item;
return $this;
* @return boolean
public function isBatch() : bool
return $this->isBatch;
* @return (JsonRpcRequest|\Exception)[]
public function getItemtList() : array
return $this->itemList;