Completed
Push — master ( b3f98f...654a3a )
by Arman
20s queued 16s
created

BaseException::methodNotSupported()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
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.7
13
 */
14
15
namespace Quantum\App\Exceptions;
16
17
use Exception;
18
19
/**
20
 * Class BaseException
21
 * @package Quantum\App
22
 */
23
class BaseException extends Exception
24
{
25
26
    /**
27
     * @param string $methodName
28
     * @param string $className
29
     * @return self
30
     */
31
    public static function methodNotSupported(string $methodName, string $className): self
32
    {
33
        return new static(
34
            "The method `$methodName` is not supported for `$className`",
35
            E_WARNING
36
        );
37
    }
38
39
    /**
40
     * @param string $name
41
     * @return self
42
     */
43
    public static function adapterNotSupported(string $name): self
44
    {
45
        return new static(
46
            "The adapter `$name` is not supported`",
47
            E_ERROR
48
        );
49
    }
50
51
    /**
52
     * @param string $name
53
     * @return self
54
     */
55
    public static function driverNotSupported(string $name): self
56
    {
57
        return new static(
58
            "The driver `$name` is not supported",
59
            E_ERROR
60
        );
61
    }
62
63
    /**
64
     * @param string $name
65
     * @return self
66
     */
67
    public static function fileNotFound(string $name): self
68
    {
69
        return new static(
70
            "The file `$name` not found",
71
            E_ERROR
72
        );
73
    }
74
}