Passed
Pull Request — master (#88)
by Arman
06:12 queued 03:03
created

DatabaseException::methodNotSupported()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
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.8.0
13
 */
14
15
namespace Quantum\Exceptions;
16
17
/**
18
 * Class DatabaseException
19
 * @package Quantum\Exceptions
20
 */
21
class DatabaseException extends AppException
22
{
23
    /**
24
     * @return \Quantum\Exceptions\DatabaseException
25
     */
26
    public static function missingConfig(): DatabaseException
27
    {
28
        return new static(t('exception.config_not_provided'), E_ERROR);
29
    }
30
31
    /**
32
     * @return \Quantum\Exceptions\DatabaseException
33
     */
34
    public static function incorrectConfig(): DatabaseException
35
    {
36
        return new static(t('exception.incorrect_config'), E_ERROR);
37
    }
38
39
    /**
40
     * @return \Quantum\Exceptions\DatabaseException
41
     */
42
    public static function ormClassNotDefined(): DatabaseException
43
    {
44
        return new static(t('exception.orm_class_not_defined'), E_ERROR);
45
    }
46
47
    /**
48
     * @param string $name
49
     * @return \Quantum\Exceptions\DatabaseException
50
     */
51
    public static function ormClassNotFound(string $name): DatabaseException
52
    {
53
        return new static(t('exception.orm_class_not_found', $name), E_ERROR);
54
    }
55
56
    /**
57
     * @param string $operator
58
     * @return \Quantum\Exceptions\DatabaseException
59
     */
60
    public static function operatorNotSupported(string $operator): DatabaseException
61
    {
62
        return new static(t('not_supported_operator', [$operator]), E_WARNING);
63
    }
64
}
65