Lines 100.00% 16 / 16
Methods 100.00% 2 / 2
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 [BO\Zmsclient\Exception] __construct 100.00% 9 / 9 100.00% 1 / 1 3
 [BO\Zmsclient\Exception] getRequestInfoString 100.00% 7 / 7 100.00% 1 / 1 2
11class BadRequest extends \BO\Zmsclient\Exception
12{
13    protected $code = 400;
14}

Inherited from BO\Zmsclient\Exception

51    public function __construct(
52        $message = '',
53        ?\Psr\Http\Message\ResponseInterface $response = null,
54        ?\Psr\Http\Message\RequestInterface $request = null,
55        ?\Exception $previous = null
56    ) {
57        $this->response = $response;
58        $this->request = $request;
59        $code = $this->code;
60        if (null !== $response) {
61            $code = $response->getStatusCode();
62        }
63        if (null !== $request) {
64            $info = $this->getRequestInfoString();
65            $message .= " $info";
66        }
67        parent::__construct($message, $code, $previous);
68    }
75    protected function getRequestInfoString()
76    {
77        $info = '';
78        if (null !== $this->request) {
79            $uri = $this->request->getRequestTarget();
80            $protocol = $this->request->getProtocolVersion();
81            $method = $this->request->getMethod();
82            $info = "($method $uri HTTP/$protocol)";
83        }
84        return $info;
85    }