ResponseException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 8
c 1
b 0
f 0
dl 0
loc 38
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getResponse() 0 3 1
A __construct() 0 6 1
A getRequest() 0 3 1
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