Passed
Pull Request — master (#182)
by Arman
06:43 queued 02:40
created

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