Passed
Push — master ( c47bc5...6702e4 )
by Anatoly
02:20
created

RouteNotFoundException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getRequest() 0 3 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-router/blob/master/LICENSE
9
 * @link https://github.com/sunrise-php/http-router
10
 */
11
12
namespace Sunrise\Http\Router\Exception;
13
14
/**
15
 * Import classes
16
 */
17
use RuntimeException, Throwable;
18
use Psr\Http\Message\ServerRequestInterface;
19
20
/**
21
 * RouteNotFoundException
22
 */
23
class RouteNotFoundException extends RuntimeException implements HttpExceptionInterface
24
{
25
26
	/**
27
	 * Server Request instance
28
	 *
29
	 * @var ServerRequestInterface
30
	 */
31
	protected $request;
32
33
	/**
34
	 * Constructor of the class
35
	 *
36
	 * @param ServerRequestInterface $request
37
	 * @param int $code
38
	 * @param null|Throwable $previous
39
	 */
40
	public function __construct(ServerRequestInterface $request, int $code = 0, Throwable $previous = null)
41
	{
42
		$this->request = $request;
43
44
		parent::__construct('Unable to find a route for the request', $code, $previous);
45
	}
46
47
	/**
48
	 * {@inheritDoc}
49
	 */
50
	public function getRequest() : ServerRequestInterface
51
	{
52
		return $this->request;
53
	}
54
}
55