Passed
Pull Request — master (#14)
by
unknown
02:46
created

LoaderException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 25
ccs 4
cts 8
cp 0.5
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A invalidLoader() 0 3 1
A backupFail() 0 3 1
A notSupportedMethod() 0 3 1
A unsupportedLoader() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Northwoods\Config\Loader;
5
6
class LoaderException extends \RuntimeException
7
{
8
    const INVALID_LOADER = 1;
9
    const UNSUPPORTED_LOADER = 2;
10
    const BACKUP_FAIL = 3;
11
    const NOT_SUPPORTED_METHOD = 4;
12
13 1
    public static function invalidLoader(string $class): LoaderException
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
14
    {
15 1
        return new static("Loader does not implement LoaderIterface: $class", self::INVALID_LOADER);
16
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
17
18 1
    public static function unsupportedLoader(string $class): LoaderException
19
    {
20 1
        return new static("Loader is missing dependencies: $class", self::UNSUPPORTED_LOADER);
21
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
22
23
    public static function backupFail(string $class): LoaderException
24
    {
25
        return new static("Loader unload is unable to save a backup, please check your permissions: $class", self::BACKUP_FAIL);
26
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
27
28
    public static function notSupportedMethod(string $method, string $class): LoaderException
29
    {
30
        return new static("The $method is not yet supported for the following loader : $class", self::NOT_SUPPORTED_METHOD);
31
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
32
}
33