ResponseException::getResponse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
4
namespace Manticoresearch\Exceptions;
5
6
use Manticoresearch\Request;
7
use Manticoresearch\Response;
8
use Throwable;
9
10
/**
11
 * Class ResponseException
12
 * @package Manticoresearch\Exceptions
13
 */
14
class ResponseException extends \RuntimeException implements ExceptionInterface
15
{
16
    /**
17
     * @var Request
18
     */
19
    protected $request;
20
    /**
21
     * @var Response
22
     */
23
    protected $response;
24
25
    /**
26
     * ResponseException constructor.
27
     * @param Request $request
28
     * @param Response $response
29
     */
30
    public function __construct(Request $request, Response $response)
31
    {
32
        $this->request = $request;
33
        $this->response = $response;
34
35
        parent::__construct($response->getError());
36
    }
37
38
    /**
39
     * @return Request
40
     */
41
    public function getRequest() :Request
42
    {
43
        return $this->request;
44
    }
45
46
    /**
47
     * @return Response
48
     */
49
    public function getResponse() :Response
50
    {
51
        return $this->response;
52
    }
53
}
54