PageNotFoundException::create()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace Mouf\Mvc\Splash\Exception;
4
5
/**
6
 * Throw this exception when a page is not found.
7
 * This will generate an HTTP 404 response.
8
 */
9
class PageNotFoundException extends \RuntimeException
10
{
11
    private $url;
12
13
    public static function create(string $url)
14
    {
15
        $exception = new self('Page not found: '.$url, 404);
16
        $exception->url = $url;
17
18
        return $exception;
19
    }
20
21
    /**
22
     * @return string
23
     */
24
    public function getUrl() : string
25
    {
26
        return $this->url;
27
    }
28
}
29