Completed
Push — master ( 16c8a5...965897 )
by Michael
02:58
created

ServerResponseException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 0
cbo 1
dl 0
loc 28
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getServerResponse() 0 4 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
 * @version 1.0.0
9
 */
10
11
namespace miBadger\Http;
12
13
/**
14
 * The server response exception class.
15
 *
16
 * @since 1.0.0
17
 */
18
class ServerResponseException extends \Exception
19
{
20
	/** @var ServerResponse The server response. */
21
	private $serverResponse;
22
23
	/**
24
	 * Contract a server response exception with the gieven server response.
25
	 *
26
	 * @param ServerResponse $serverResponse
27
	 * @param \Exception|null $exception = null
28
	 */
29 2
	public function __construct(ServerResponse $serverResponse, \Exception $exception = null)
30
	{
31 2
		parent::__construct($serverResponse->getReasonPhrase(), $serverResponse->getStatusCode(), $exception);
32
33 2
		$this->serverResponse = $serverResponse;
34 2
	}
35
36
	/**
37
	 * Returns the server response.
38
	 *
39
	 * @return ServerResponse the server response.
40
	 */
41 1
	public function getServerResponse()
42
	{
43 1
		return $this->serverResponse;
44
	}
45
}
46