HttpClientException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getRequest() 0 4 1
A getResponse() 0 4 1
1
<?php
2
/**
3
 * WooCommerce REST API HTTP Client Exception
4
 *
5
 * @category HttpClient
6
 * @package  Automattic/WooCommerce
7
 */
8
9
namespace Automattic\WooCommerce\HttpClient;
10
11
use Automattic\WooCommerce\HttpClient\Request;
12
use Automattic\WooCommerce\HttpClient\Response;
13
14
/**
15
 * REST API HTTP Client Exception class.
16
 *
17
 * @package Automattic/WooCommerce
18
 */
19
class HttpClientException extends \Exception
20
{
21
    /**
22
     * Request.
23
     *
24
     * @var Request
25
     */
26
    private $request;
27
28
    /**
29
     * Response.
30
     *
31
     * @var Response
32
     */
33
    private $response;
34
35
    /**
36
     * Initialize exception.
37
     *
38
     * @param string   $message  Error message.
39
     * @param int      $code     Error code.
40
     * @param Request  $request  Request data.
41
     * @param Response $response Response data.
42
     */
43
    public function __construct($message, $code, Request $request, Response $response)
44
    {
45
        parent::__construct($message, $code);
46
47
        $this->request  = $request;
48
        $this->response = $response;
49
    }
50
51
    /**
52
     * Get request data.
53
     *
54
     * @return Request
55
     */
56
    public function getRequest()
57
    {
58
        return $this->request;
59
    }
60
61
    /**
62
     * Get response data.
63
     *
64
     * @return Response
65
     */
66
    public function getResponse()
67
    {
68
        return $this->response;
69
    }
70
}
71