Passed
Push — main ( 1fe2cd...c1deb1 )
by Dimitri
04:10
created

PageNotFoundException::methodNotFound()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 1
cp 0
crap 2
rs 10
1
<?php
2
3
/**
4
 * This file is part of Blitz PHP framework.
5
 *
6
 * (c) 2022 Dimitri Sitchet Tomkeu <[email protected]>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11
12
namespace BlitzPHP\Exceptions;
13
14
use OutOfBoundsException;
15
16
class PageNotFoundException extends OutOfBoundsException implements ExceptionInterface
17
{
18
    use DebugTraceableTrait;
19
20
    /**
21
     * Code d'erreur
22
     *
23
     * @var int
24
     */
25
    protected $code = 404;
26
27
    public static function pageNotFound(?string $message = null)
28
    {
29
        return new static($message ?? self::lang('HTTP.pageNotFound'));
30
    }
31
32
    public static function emptyController()
33
    {
34
        return new static(self::lang('HTTP.emptyController'));
35
    }
36
37
    public static function controllerNotFound(string $controller, string $method)
38
    {
39
        return new static(self::lang('HTTP.controllerNotFound', [$controller, $method]));
40
    }
41
42
    public static function methodNotFound(string $method)
43
    {
44
        return new static(self::lang('HTTP.methodNotFound', [$method]));
45
    }
46
47
    public static function localeNotSupported(string $locale)
48
    {
49 2
        return new static(self::lang('HTTP.localeNotSupported', [$locale]));
50
    }
51
}
52