Completed
Push — master ( 8fa479...2305de )
by smiley
03:05
created

NetworkException::getRequest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 3
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 3
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Class NetworkException
4
 *
5
 * @filesource   NetworkException.php
6
 * @created      10.09.2018
7
 * @package      chillerlan\HTTP
8
 * @author       smiley <[email protected]>
9
 * @copyright    2018 smiley
10
 * @license      MIT
11
 */
12
13
namespace chillerlan\HTTP;
14
15
use Exception;
16
use Psr\Http\Client\NetworkExceptionInterface;
17
use Psr\Http\Message\RequestInterface;
18
19 View Code Duplication
class NetworkException extends ClientException implements NetworkExceptionInterface{
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
20
21
	/**
22
	 * @var \Psr\Http\Message\RequestInterface
23
	 */
24
	private $request;
25
26
	/**
27
	 * @param string                             $message
28
	 * @param \Psr\Http\Message\RequestInterface $request
29
	 * @param \Exception|null                    $previous
30
	 */
31
	public function __construct(string $message, RequestInterface $request, Exception $previous = null){
32
		$this->request = $request;
33
34
		parent::__construct($message, 0, $previous);
35
	}
36
37
	/**
38
	 * Returns the request.
39
	 *
40
	 * The request object MAY be a different object from the one passed to ClientInterface::sendRequest()
41
	 *
42
	 * @return \Psr\Http\Message\RequestInterface
43
	 */
44
	public function getRequest():RequestInterface{
45
		return $this->request;
46
	}
47
48
}
49