Completed
Push — develop ( fa42c1...0ef7d4 )
by Sergei
22:52
created

AbstractDriverException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Test Coverage

Coverage 53.85%

Importance

Changes 0
Metric Value
wmc 3
eloc 8
dl 0
loc 43
ccs 7
cts 13
cp 0.5385
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getErrorCode() 0 3 1
A getSQLState() 0 3 1
1
<?php
2
3
namespace Doctrine\DBAL\Driver;
4
5
use Exception;
6
7
/**
8
 * Abstract base implementation of the {@link DriverException} interface.
9
 */
10
abstract class AbstractDriverException extends Exception implements DriverException
11
{
12
    /**
13
     * The driver specific error code.
14
     *
15
     * @var int|string|null
16
     */
17
    private $errorCode;
18
19
    /**
20
     * The SQLSTATE of the driver.
21
     *
22
     * @var string|null
23
     */
24
    private $sqlState;
25
26
    /**
27
     * @param string          $message   The driver error message.
28
     * @param string|null     $sqlState  The SQLSTATE the driver is in at the time the error occurred, if any.
29
     * @param int|string|null $errorCode The driver specific error code if any.
30
     */
31 1051
    public function __construct($message, $sqlState = null, $errorCode = null)
32
    {
33 1051
        parent::__construct($message);
34
35 1051
        $this->errorCode = $errorCode;
36 1051
        $this->sqlState  = $sqlState;
37 1051
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42 927
    public function getErrorCode()
43
    {
44 927
        return $this->errorCode;
45
    }
46
47
    /**
48
     * {@inheritdoc}
49
     */
50
    public function getSQLState()
51
    {
52
        return $this->sqlState;
53
    }
54
}
55