ApplicationException::forInvalidModule()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace Igni\Application\Exception;
4
5
use Igni\Application\Controller;
6
use Igni\Exception\RuntimeException;
7
8
class ApplicationException extends RuntimeException
9
{
10
    public static function forInvalidModule($module): self
11
    {
12
        $dumped = var_export($module, true);
13
        return new self("Passed module (${dumped}) is not valid module.");
14
    }
15
16
    public static function forInvalidController($controller): self
17
    {
18
        $dumped = var_export($controller, true);
19
        return new self(
20
            "Passed controller (${dumped}) is not valid controller, 
21
            controller must be callable or implement " . Controller::class . ' interface'
22
        );
23
    }
24
}
25