ConfigFileUnparsable::constructFromPath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
namespace UltraLite\ConfigReader\ConfigReaderException;
3
4
use UltraLite\ConfigReader\ConfigReaderException;
5
6
class ConfigFileUnparsable extends \RuntimeException implements ConfigReaderException
7
{
8
    public static function constructFromPath(string $path): ConfigFileUnparsable
9
    {
10
        $message = "Config file not parsable: '$path'";
11
        return new static($message);
12
    }
13
14
    public static function constructFromThrowable(\Throwable $throwable, string $path): ConfigFileUnparsable
15
    {
16
        $message = 'Encountered error parsing config file "' . $path . '". Message was: "' . $throwable->getMessage() .'"';
17
        return new static($message, $throwable->getCode(), $throwable);
18
    }
19
}
20