Exception   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 10
dl 0
loc 42
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getSentence() 0 3 1
A getErrorInfo() 0 3 1
1
<?php
2
3
namespace Cozy\Database\Relational;
4
5
class Exception extends \RuntimeException
6
{
7
    /** @var string */
8
    protected $sentence;
9
    /** @var string */
10
    protected $code;
11
    /** @var array */
12
    protected $errorInfo = [];
13
14
    /**
15
     * Exception constructor.
16
     *
17
     * @param string $message
18
     * @param mixed $code
19
     * @param array $error_info
20
     * @param string|null $sentence
21
     */
22
    public function __construct(string $message = '', $code = null, array $error_info = [], string $sentence = '')
23
    {
24
        parent::__construct($message, 0);
25
26
        $this->code = $code;
27
        $this->errorInfo = $error_info;
28
        $this->sentence = $sentence;
29
    }
30
31
    /**
32
     * Gets the SQL sentence
33
     * @return string the SQL sentence as a string.
34
     */
35
    public function getSentence(): string
36
    {
37
        return $this->sentence;
38
    }
39
40
    /**
41
     * Gets detailed information of error
42
     * @return array the PDO error information as an array.
43
     */
44
    public function getErrorInfo(): array
45
    {
46
        return $this->errorInfo;
47
    }
48
}
49