Completed
Pull Request — master (#329)
by Vojtěch
09:52
created

DBALException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 46
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A __sleep() 0 4 1
1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 10 and the first side effect is on line 57.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
namespace Kdyby\Doctrine\Exception;
4
use Doctrine;
5
6
/**
7
 * @author Filip Procházka <[email protected]>
8
 * @deprecated
9
 */
10
class DBALException extends \RuntimeException implements IException
11
{
12
13
    /**
14
     * @var string|NULL
15
     */
16
    public $query;
17
18
    /**
19
     * @var array
20
     */
21
    public $params = [];
22
23
    /**
24
     * @var \Doctrine\DBAL\Connection|NULL
25
     */
26
    public $connection;
27
28
29
    /**
30
     * @param \Exception|\Throwable          $previous
31
     * @param string|NULL                    $query
32
     * @param array                          $params
33
     * @param \Doctrine\DBAL\Connection|NULL $connection
34
     * @param string|NULL                    $message
35
     */
36
    public function __construct($previous, $query = NULL, $params = [], Doctrine\DBAL\Connection $connection = NULL, $message = NULL)
37
    {
38
        parent::__construct($message ?: $previous->getMessage(), $previous->getCode(), $previous);
39
        $this->query = $query;
40
        $this->params = $params;
41
        $this->connection = $connection;
42
    }
43
44
45
    /**
46
     * This is just a paranoia, hopes no one actually serializes exceptions.
47
     *
48
     * @return array
49
     */
50
    public function __sleep()
51
    {
52
        return ['message', 'code', 'file', 'line', 'errorInfo', 'query', 'params'];
53
    }
54
55
}
56
57
class_alias(DBALException::class, 'Kdyby\Doctrine\DBALException');
58