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

ModelException   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 3
c 0
b 0
f 0
dl 0
loc 20
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A inappropriateProperty() 0 3 1
A wrongRelation() 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\Model\Exceptions;
16
17
use Quantum\Model\Enums\ExceptionMessages;
18
use Quantum\App\Exceptions\BaseException;
19
20
/**
21
 * Class ModelException
22
 * @package Quantum\Model
23
 */
24
class ModelException extends BaseException
25
{
26
27
    /**
28
     * @param string $name
29
     * @return ModelException
30
     */
31
    public static function inappropriateProperty(string $name): ModelException
32
    {
33
        return new static(_message(ExceptionMessages::INAPPROPRIATE_MODEL_PROPERTY, $name), E_WARNING);
34
    }
35
36
    /**
37
     * @param string $modelName
38
     * @param string $tableName
39
     * @return ModelException
40
     */
41
    public static function wrongRelation(string $modelName, string $tableName): ModelException
42
    {
43
        return new static(_message(ExceptionMessages::WRONG_RELATION, [$modelName, $tableName]), E_ERROR);
44
    }
45
}
46