CurlRequestCallException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 41
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getResponse() 0 3 1
A setResponse() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the core-library package.
5
 *
6
 * (c) 2018 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Library\Core\Network\CURL\Exception;
13
14
use WBW\Library\Core\Network\CURL\API\CurlResponseInterface;
15
16
/**
17
 * cURL request call exception.
18
 *
19
 * @author webeweb <https://github.com/webeweb/>
20
 * @package WBW\Library\Core\Network\CURL\Exception
21
 */
22
class CurlRequestCallException extends AbstractCurlException {
23
24
    /**
25
     * cURL response.
26
     *
27
     * @var CurlResponseInterface|null
28
     */
29
    private $response;
30
31
    /**
32
     * Constructor.
33
     *
34
     * @param string $message The message.
35
     * @param int $code The code.
36
     * @param CurlResponseInterface $response The response.
37
     */
38
    public function __construct(string $message, int $code, CurlResponseInterface $response) {
39
        parent::__construct($message, $code);
40
        $this->setResponse($response);
41
    }
42
43
    /**
44
     * Get the response.
45
     *
46
     * @return CurlResponseInterface|null Returns the response.
47
     */
48
    public function getResponse(): ?CurlResponseInterface {
49
        return $this->response;
50
    }
51
52
    /**
53
     * Set the response.
54
     *
55
     * @param CurlResponseInterface $response The response.
56
     * @return CurlRequestCallException Returns this request call exception.
57
     */
58
    protected function setResponse(CurlResponseInterface $response): CurlRequestCallException {
59
        $this->response = $response;
60
        return $this;
61
    }
62
}
63