Completed
Push — master ( 69686b...b3f98f )
by Arman
21s queued 16s
created

ModuleException::moduleConfigNotFound()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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\Module\Exceptions;
16
17
/**
18
 * Class ModuleLoaderException
19
 * @package Quantum\Module
20
 */
21
class ModuleException extends \Exception
22
{
23
    /**
24
     * @param string $name
25
     * @return ModuleException
26
     */
27
    public static function moduleRoutesNotFound(string $name): ModuleException
28
    {
29
        return new static(t('exception.module_routes_not_found', $name), E_ERROR);
30
    }
31
32
    /**
33
     * @return ModuleException
34
     */
35
    public static function moduleConfigNotFound(): ModuleException
36
    {
37
        return new static(t('exception.module_config_not_found'), E_ERROR);
38
    }
39
40
    /**
41
     * @return ModuleException
42
     */
43
    public static function moduleCreationIncomplete(): ModuleException
44
    {
45
        return new static("Module creation incomplete: missing files.", E_ERROR);
46
    }
47
48
    /**
49
     * @param string $name
50
     * @return ModuleException
51
     */
52
    public static function missingModuleTemplate(string $name): ModuleException
53
    {
54
        return new static("Template `" . $name . "` does not exist", E_ERROR);
55
    }
56
57
    /**
58
     * @return ModuleException
59
     */
60
    public static function missingModuleDirectory(): ModuleException
61
    {
62
        return new static("Module directory does not exist, skipping config update.", E_ERROR);
63
    }
64
65
    /**
66
     * @param string $name
67
     * @return ModuleException
68
     */
69
    public static function moduleAlreadyExists(string $name): ModuleException
70
    {
71
        return new static("A module or prefix named `" . $name . "` already exists", E_ERROR);
72
    }
73
}