Passed
Push — develop ( 2d7b42...b3143e )
by Brent
03:12
created

ConfigurationException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A requiredAdapterOptions() 0 7 3
A fileNotFound() 0 3 1
1
<?php
2
3
namespace Brendt\Stitcher\Exception;
4
5
class ConfigurationException extends StitcherException
6
{
7
8
    /**
9
     * @param       $adapter
10
     * @param array ...$fields
11
     *
12
     * @return ConfigurationException
13
     */
14
    public static function requiredAdapterOptions($adapter, ...$fields) : ConfigurationException {
15
        $entries = count($fields) > 1 ? 'entries' : 'entry';
16
        $are = count($fields) > 1 ? 'are' : 'is';
17
        $fields = implode('`, `', $fields);
18
19
        return new self("The configuration {$entries} `{$fields}` {$are} required when using the {$adapter} adapter.");
20
    }
21
22
    /**
23
     * @param $path
24
     *
25
     * @return ConfigurationException
26
     */
27
    public static function fileNotFound($path) : ConfigurationException {
28
        return new self("Could not load file: `{$path}`.");
29
    }
30
31
}
32