ApplicationException   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 14
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A forInvalidModule() 0 4 1
A forInvalidController() 0 6 1
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