fromNameWhenFactoryAndServiceSpecified()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
3
namespace TomPHP\ContainerConfigurator\Exception;
4
5
use LogicException;
6
use TomPHP\ExceptionConstructorTools;
7
8
final class InvalidConfigException extends LogicException implements Exception
9
{
10
    use ExceptionConstructorTools;
11
12
    /**
13
     * @internal
14
     *
15
     * @param string $filename
16
     *
17
     * @return self
18
     */
19
    public static function fromPHPFileError($filename)
20
    {
21
        return self::create('"%s" does not return a PHP array.', [$filename]);
22
    }
23
24
    /**
25
     * @internal
26
     *
27
     * @param string $filename
28
     * @param string $message
29
     *
30
     * @return self
31
     */
32
    public static function fromJSONFileError($filename, $message)
33
    {
34
        return self::create('Invalid JSON in "%s": %s', [$filename, $message]);
35
    }
36
37
    /**
38
     * @internal
39
     *
40
     * @param string $filename
41
     * @param string $message
42
     *
43
     * @return self
44
     */
45
    public static function fromYAMLFileError($filename, $message)
46
    {
47
        return self::create('Invalid YAML in "%s": %s', [$filename, $message]);
48
    }
49
50
    /**
51
     * @internal
52
     *
53
     * @param string $name
54
     *
55
     * @return self
56
     */
57
    public static function fromNameWhenClassAndFactorySpecified($name)
58
    {
59
        return self::create(
60
            'Both "class" and "factory" are specified for service "%s"; these cannot be used together.',
61
            [$name]
62
        );
63
    }
64
65
    /**
66
     * @internal
67
     *
68
     * @param string $name
69
     *
70
     * @return self
71
     */
72
    public static function fromNameWhenClassAndServiceSpecified($name)
73
    {
74
        return self::create(
75
            'Both "class" and "service" are specified for service "%s"; these cannot be used together.',
76
            [$name]
77
        );
78
    }
79
80
    /**
81
     * @internal
82
     *
83
     * @param string $name
84
     *
85
     * @return self
86
     */
87
    public static function fromNameWhenFactoryAndServiceSpecified($name)
88
    {
89
        return self::create(
90
            'Both "factory" and "service" are specified for service "%s"; these cannot be used together.',
91
            [$name]
92
        );
93
    }
94
}
95