Completed
Push — master ( aef338...f2de0d )
by Damien
02:37
created

ConfigurationException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A missingKey() 0 6 1
A missingSubkey() 0 10 1
A missingImportedFile() 0 6 1
1
<?php
2
/**
3
 * Veto.
4
 * PHP Microframework.
5
 *
6
 * @author Damien Walsh <[email protected]>
7
 * @copyright Damien Walsh 2013-2014
8
 * @version 0.1
9
 * @package veto
10
 */
11
namespace Veto\Configuration\Exception;
12
13
/**
14
 * ConfigurationException
15
 *
16
 * Represents a problem with the configuration loaded by the application.
17
 *
18
 * @since 0.1
19
 */
20
class ConfigurationException extends \Exception
21
{
22
    public static function missingKey($expectedKey)
23
    {
24
        return new self(
25
            sprintf('Key "%s" must be specified in the application configuration.', $expectedKey)
26
        );
27
    }
28
29
    public static function missingSubkey($parentKey, $expectedSubkey)
30
    {
31
        return new self(
32
            sprintf(
33
                'Key "%s" must contain a child "%s" in the application configuration.',
34
                $parentKey,
35
                $expectedSubkey
36
            )
37
        );
38
    }
39
40
    public static function missingImportedFile($file, $importedFrom)
41
    {
42
        return new self(
43
            sprintf('File %s (imported from %s) does not exist.', $file, $importedFrom)
44
        );
45
    }
46
}
47