Completed
Push — master ( 8d39d6...58e1d9 )
by Xeriab
02:50
created

ParseException::__construct()   B

Complexity

Conditions 7
Paths 64

Size

Total Lines 18
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 18
rs 8.2222
cc 7
eloc 14
nc 64
nop 1
1
<?php
2
3
/**
4
 * Konfig
5
 *
6
 * Yet another simple configuration loader library.
7
 *
8
 * @author  Xeriab Nabil (aka KodeBurner) <[email protected]>
9
 * @license https://raw.github.com/xeriab/konfig/master/LICENSE MIT
10
 * @link    https://xeriab.github.io/projects/konfig
11
 */
12
13
namespace Exen\Konfig\Exception;
14
15
class ParseException extends ErrorException
16
{
17
    /**
18
     * Constructor.
19
     *
20
     * @param array      $arr    The error array
21
     * @codeCoverageIgnore
22
     */
23
    public function __construct(array $arr)
24
    {
25
        $message   = isset($arr['message']) ? $arr['message'] : 'There was an error parsing the file';
26
        $code      = isset($arr['code']) ? $arr['code'] : 0;
27
        $severity  = isset($arr['type']) ? $arr['type'] : 1;
28
        $file      = isset($arr['file']) ? $arr['file'] : __FILE__;
29
        $line      = isset($arr['line']) ? $arr['line'] : __LINE__;
30
        $exception = isset($arr['exception']) ? $arr['exception'] : null;
31
32
        parent::__construct(
33
            $message,
34
            $code,
35
            $severity,
36
            $file,
37
            $line,
38
            $exception
39
        );
40
    }
41
}
42
43
// END OF ./src/Exception/ParseException.php FILE
44