ParseException   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 7
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 30
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B __construct() 0 20 7
1
<?php
2
3
/**
4
 * Konfig.
5
 *
6
 * Yet another simple configuration loader library.
7
 *
8
 * PHP version 5
9
 *
10
 * @category Library
11
 * @package  Konfig
12
 * @author   Xeriab Nabil (aka KodeBurner) <[email protected]>
13
 * @license  https://raw.github.com/xeriab/konfig/master/LICENSE MIT
14
 * @link     https://xeriab.github.io/projects/konfig
15
 */
16
17
namespace Exen\Konfig\Exception;
18
19
/**
20
 * Parse exception class
21
 *
22
 * @category Exception.
23
 * @package  Konfig
24
 * @author   Xeriab Nabil (aka KodeBurner) <[email protected]>
25
 * @license  https://raw.github.com/xeriab/konfig/master/LICENSE MIT
26
 * @link     https://xeriab.github.io/projects/konfig
27
 */
28
class ParseException extends ErrorException
29
{
30
    /**
31
     * Constructor.
32
     *
33
     * @param array $arr The error array
34
     *
35
     * @codeCoverageIgnore
36
     */
37
    public function __construct(array $arr)
38
    {
39
        $message = isset($arr['message']) ?
40
            $arr['message'] :
41
            'There was an error parsing the file';
42
        $code = isset($arr['code']) ? $arr['code'] : 0;
43
        $severity = isset($arr['type']) ? $arr['type'] : 1;
44
        $file = isset($arr['file']) ? $arr['file'] : __FILE__;
45
        $line = isset($arr['line']) ? $arr['line'] : __LINE__;
46
        $exception = isset($arr['exception']) ? $arr['exception'] : null;
47
48
        parent::__construct(
49
            $message,
50
            $code,
51
            $severity,
52
            $file,
53
            $line,
54
            $exception
55
        );
56
    }
57
}
58
59
// END OF ./src/Exception/ParseException.php FILE
60