Passed
Push — drop-deprecated ( db0b1f )
by Michael
27:00
created

AbstractDriverException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 28
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

2 Methods

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