RouteNotFoundException::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
nc 2
nop 3
dl 0
loc 7
ccs 4
cts 4
cp 1
crap 2
rs 10
c 1
b 0
f 0
1
<?php declare(strict_types=1);
2
3
/*
4
 * This file is part of Flight Routing.
5
 *
6
 * PHP version 8.0 and above required
7
 *
8
 * @author    Divine Niiquaye Ibok <[email protected]>
9
 * @copyright 2019 Divine Niiquaye Ibok (https://divinenii.com/)
10
 * @license   https://opensource.org/licenses/BSD-3-Clause License
11
 *
12
 * For the full copyright and license information, please view the LICENSE
13
 * file that was distributed with this source code.
14
 */
15
16
namespace Flight\Routing\Exceptions;
17
18
use Flight\Routing\Interfaces\ExceptionInterface;
19
use Psr\Http\Message\UriInterface;
20
21
/**
22
 * Class RouteNotFoundException.
23
 */
24
class RouteNotFoundException extends \DomainException implements ExceptionInterface
25
{
26 9
    public function __construct(string|UriInterface $message = '', int $code = 404, \Throwable $previous = null)
27
    {
28 9
        if ($message instanceof UriInterface) {
29 9
            $message = \sprintf('Unable to find the controller for path "%s". The route is wrongly configured.', $message->getPath());
30
        }
31
32 9
        parent::__construct($message, $code, $previous);
33
    }
34
}
35