Passed
Push — master ( 442876...4ec1bc )
by Felipe
15:55 queued 10:33
created

ADOdbException::__construct()   C

Complexity

Conditions 7
Paths 20

Size

Total Lines 32
Code Lines 23

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 7
eloc 23
nc 20
nop 7
dl 0
loc 32
rs 6.7272
c 0
b 0
f 0
1
<?php
2
/*
0 ignored issues
show
Coding Style introduced by
You must use "/**" style comments for a file comment
Loading history...
3
 * PHPPgAdmin v6.0.0-beta.30
4
 */
5
namespace PHPPgAdmin;
6
7
/**
8
 * Released under both BSD license and Lesser GPL library license. Whenever
9
 * there is any discrepancy between the two licenses, the BSD license will take
10
 * precedence.
11
 * Set tabs to 4 for best viewing.
12
 * Latest version is available at http://php.weblogs.com
13
 * Exception-handling code using PHP5 exceptions (try-catch-throw).
14
 *
15
 * @package PHPPgAdmin
16
 * @author John Lim
1 ignored issue
show
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
17
 * @copyright 2000-2013 John Lim <[email protected]>
18
 * @copyright 2014      Damien Regad, Mark Newnham and the ADOdb community
19
 * @license MIT
1 ignored issue
show
Coding Style introduced by
@license tag must contain a URL and a license name
Loading history...
20
 * @version   Release: 5.20.9
21
 */
2 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
22
class ADOdbException extends \Exception
23
{
24
    public $dbms;
25
    public $fn;
26
    public $sql      = '';
27
    public $params   = '';
28
    public $host     = '';
29
    public $database = '';
30
31
    public function __construct($dbms, $fn, $errno, $errmsg, $p1, $p2, $thisConnection)
1 ignored issue
show
Coding Style introduced by
Missing function doc comment
Loading history...
32
    {
33
        switch ($fn) {
34
            case 'EXECUTE':
35
                $this->sql    = is_array($p1) ? $p1[0] : $p1;
36
                $this->params = $p2;
37
                $s            = "$dbms error: [$errno: $errmsg] in $fn(\"$this->sql\")";
38
                break;
39
40
            case 'PCONNECT':
41
            case 'CONNECT':
42
                $user = $thisConnection->user;
43
                $s    = "$dbms error: [$errno: $errmsg] in $fn($p1, '$user', '****', $p2)";
44
                break;
45
            default:
46
                $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)";
47
                break;
48
        }
49
50
        $this->dbms = $dbms;
51
        if ($thisConnection) {
52
            $this->host     = $thisConnection->host;
53
            $this->database = $thisConnection->database;
54
        }
55
        $this->fn  = $fn;
56
        $this->msg = $errmsg;
57
58
        if (!is_numeric($errno)) {
59
            $errno = -1;
60
        }
61
62
        parent::__construct($s, $errno);
63
    }
64
}
65