ServerResponseException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 26
ccs 6
cts 6
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getServerResponse() 0 3 1
A __construct() 0 5 1
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