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

ConfigurationException::missingKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 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