Completed
Push — master ( 8c15b3...f8d4b2 )
by Arman
15s queued 11s
created

DatabaseException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 36
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A incorrectConfig() 0 3 1
A tableDoesNotExists() 0 3 1
A tableAlreadyExists() 0 3 1
A operatorNotSupported() 0 3 1
1
<?php
2
3
/**
4
 * Quantum PHP Framework
5
 *
6
 * An open source software development framework for PHP
7
 *
8
 * @package Quantum
9
 * @author Arman Ag. <[email protected]>
10
 * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
11
 * @link http://quantum.softberg.org/
12
 * @since 2.9.9
13
 */
14
15
namespace Quantum\Libraries\Database\Exceptions;
16
17
use Quantum\Libraries\Database\Enums\ExceptionMessages;
18
use Quantum\App\Exceptions\BaseException;
19
20
/**
21
 * Class DatabaseException
22
 * @package Quantum\Libraries\Database
23
 */
24
class DatabaseException extends BaseException
25
{
26
27
    /**
28
     * @return DatabaseException
29
     */
30
    public static function incorrectConfig(): DatabaseException
31
    {
32
        return new static(ExceptionMessages::INCORRECT_CONFIG, E_ERROR);
33
    }
34
35
    /**
36
     * @param string $operator
37
     * @return DatabaseException
38
     */
39
    public static function operatorNotSupported(string $operator): DatabaseException
40
    {
41
        return new static(_message(ExceptionMessages::NOT_SUPPORTED_OPERATOR, [$operator]), E_WARNING);
42
    }
43
44
    /**
45
     * @param string $name
46
     * @return DatabaseException
47
     */
48
    public static function tableAlreadyExists(string $name): DatabaseException
49
    {
50
        return new static(_message(ExceptionMessages::TABLE_ALREADY_EXISTS, $name), E_ERROR);
51
    }
52
53
    /**
54
     * @param string $name
55
     * @return DatabaseException
56
     */
57
    public static function tableDoesNotExists(string $name): DatabaseException
58
    {
59
        return new static(_message(ExceptionMessages::TABLE_NOT_EXISTS, $name), E_ERROR);
60
    }
61
}