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

LoaderException::notSupportedMethod()   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
nc 1
nop 2
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
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