Passed
Push — develop ( 80559e...1e38ed )
by Brent
02:12
created

InvalidConfiguration   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 20%

Importance

Changes 0
Metric Value
dl 0
loc 27
ccs 2
cts 10
cp 0.2
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A pageIdAndTemplateRequired() 0 4 1
A fileNotFound() 0 4 1
A invalidAdapterConfiguration() 0 4 1
A dotEnvNotFound() 0 4 1
A missingParameter() 0 4 1
1
<?php
2
3
namespace Stitcher\Exception;
4
5
class InvalidConfiguration extends \Exception
6
{
7 2
    public static function pageIdAndTemplateRequired(): InvalidConfiguration
8
    {
9 2
        return new self('To create a page, both the `id` and `template` keys are required.');
10
    }
11
12
    public static function fileNotFound(string $path): InvalidConfiguration
13
    {
14
        return new self("File with path `{$path}` could not be found.");
15
    }
16
17
    public static function invalidAdapterConfiguration(string $adapter, string $fields): InvalidConfiguration
18
    {
19
        return new self("The {$adapter} adapter requires following configuration: {$fields}");
20
    }
21
22
    public static function dotEnvNotFound(string $directory): InvalidConfiguration
23
    {
24
        return new self("Could not find `.env` file. Looked in {$directory}");
25
    }
26
27
    public static function missingParameter(string $parameter): InvalidConfiguration
28
    {
29
        return new self("Missing parameter `{$parameter}`, did you add it in your config file?");
30
    }
31
}
32