ServerResponseException::getServerResponse()   A
last analyzed

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 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
1
<?php
2
3
/**
4
 * This file is part of the miBadger package.
5
 *
6
 * @author Michael Webbers <[email protected]>
7
 * @license http://opensource.org/licenses/Apache-2.0 Apache v2 License
8
 */
9
10
namespace miBadger\Http;
11
12
/**
13
 * The server response exception class.
14
 *
15
 * @since 1.0.0
16
 */
17
class ServerResponseException extends \Exception
18
{
19
	/** @var ServerResponse The server response. */
20
	private $serverResponse;
21
22
	/**
23
	 * Contract a server response exception with the gieven server response.
24
	 *
25
	 * @param ServerResponse $serverResponse
26
	 * @param \Exception|null $exception = null
27
	 */
28 2
	public function __construct(ServerResponse $serverResponse, \Exception $exception = null)
29
	{
30 2
		parent::__construct($serverResponse->getReasonPhrase(), $serverResponse->getStatusCode(), $exception);
31
32 2
		$this->serverResponse = $serverResponse;
33 2
	}
34
35
	/**
36
	 * Returns the server response.
37
	 *
38
	 * @return ServerResponse the server response.
39
	 */
40 1
	public function getServerResponse()
41
	{
42 1
		return $this->serverResponse;
43
	}
44
}
45