ConfigFileUnparsable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 14
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A constructFromPath() 0 5 1
A constructFromThrowable() 0 5 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