SqlException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
dl 0
loc 17
rs 10
c 1
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
1
<?php declare(strict_types=1);
2
3
/** 
4
 *  ___      _        _
5
 * | _ \__ _| |_ __ _| |__  __ _ ___ ___
6
 * |  _/ _` |  _/ _` | '_ \/ _` (_-</ -_)
7
 * |_| \__,_|\__\__,_|_.__/\__,_/__/\___|
8
 * 
9
 * This file is part of Kristuff\Patabase.
10
 * (c) Kristuff <[email protected]>
11
 *
12
 * For the full copyright and license information, please view the LICENSE
13
 * file that was distributed with this source code.
14
 *
15
 * @version    1.0.1
16
 * @copyright  2017-2022 Christophe Buliard
17
 */
18
19
namespace Kristuff\Patabase;
20
21
/**
22
 * Class SqlException
23
 */
24
class SqlException extends \Exception
25
{
26
    /**
27
     * Initializes the exception with givn parent exception
28
     *
29
     * Converts the error code to int in case driver returns it as string.  
30
     *
31
     * @access public
32
     * @param string        $message
33
     * @param int           $code
34
     * @param \Exception    $previous
35
     */
36
    public function __construct(string $message, int $code = 0, ?\Exception $previous = null)
37
    {
38
        
39
        // some drivers may return $code as string => force int 
40
        parent::__construct($message, intval($code), $previous);
41
    }
42
}