Passed
Branch master (c482ba)
by Anatoly
03:50 queued 02:22
created

RequestException::getRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php declare(strict_types=1);
2
3
/**
4
 * It's free open-source software released under the MIT License.
5
 *
6
 * @author Anatoly Fenric <[email protected]>
7
 * @copyright Copyright (c) 2018, Anatoly Fenric
8
 * @license https://github.com/sunrise-php/http-client-curl/blob/master/LICENSE
9
 * @link https://github.com/sunrise-php/http-client-curl
10
 */
11
12
namespace Sunrise\Http\Client\Curl\Exception;
13
14
/**
15
 * Import classes
16
 */
17
use Throwable;
18
use Psr\Http\Client\RequestExceptionInterface;
19
use Psr\Http\Message\RequestInterface;
20
21
/**
22
 * RequestException
23
 */
24
class RequestException extends ClientException implements RequestExceptionInterface
25
{
26
27
    /**
28
     * Request instance
29
     *
30
     * @var RequestInterface
31
     */
32
    protected $request;
33
34
    /**
35
     * Constructor of the class
36
     *
37
     * @param RequestInterface $request
38
     * @param string $message
39
     * @param int $code
40
     * @param Throwable $previous
41
     */
42 1
    public function __construct(
43
        RequestInterface $request,
44
        string $message = '',
45
        int $code = 0,
46
        Throwable $previous = null
47
    ) {
48 1
        $this->request = $request;
49 1
        parent::__construct($message, $code, $previous);
50 1
    }
51
52
    /**
53
     * {@inheritDoc}
54
     */
55 1
    public function getRequest() : RequestInterface
56
    {
57 1
        return $this->request;
58
    }
59
}
60