ClientException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 27
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getRequest() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * This file is part of slick/http
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 Slick\Http\Client\Exception;
13
14
use Exception;
15
use Psr\Http\Client\ClientExceptionInterface;
16
use Psr\Http\Message\RequestInterface;
17
18
/**
19
 * ClientException
20
 *
21
 * @package Slick\Http\Client\Exception
22
 */
23
abstract class ClientException extends Exception implements ClientExceptionInterface
24
{
25
    /**
26
     * @var RequestInterface
27
     */
28
    private RequestInterface $request;
29
30
    /**
31
     * Creates a NetworkException
32
     *
33
     * @param RequestInterface $request
34
     * @param string $message
35
     */
36
    public function __construct(RequestInterface $request, string $message = "")
37
    {
38
        parent::__construct($message);
39
        $this->request = $request;
40
    }
41
42
    /**
43
     * Retrieves the associated request instance.
44
     *
45
     * @return RequestInterface The request associated with this instance.
46
     */
47
    public function getRequest(): RequestInterface
48
    {
49
        return $this->request;
50
    }
51
}
52