ModuleException::getModuleClass()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php namespace BuildR\ClassLoader\Exception;
2
3
use \Exception;
4
5
/**
6
 * Collection of exceptions when thrown in various class.
7
 *
8
 * BuildR PHP Framework
9
 *
10
 * @author Zoltán Borsos <[email protected]>
11
 * @package ClassLoader
12
 * @subpackage Exception
13
 *
14
 * @copyright    Copyright 2015, Zoltán Borsos.
15
 * @license      https://github.com/Zolli/BuildR/blob/master/LICENSE.md
16
 * @link         https://github.com/Zolli/BuildR
17
 *
18
 * @codeCoverageIgnore
19
 */
20
class ModuleException extends Exception {
21
22
    const MESSAGE_MODULE_INVALID = "Invalid Class Loader Module!";
23
24
    const MESSAGE_MODULE_NOT_FOUND = "The given class loader not found!";
25
26
    /**
27
     * @type string
28
     */
29
    private $moduleClass;
30
31
    public static function invalid($moduleClass) {
32
        return new self(self::MESSAGE_MODULE_INVALID, $moduleClass);
33
    }
34
35
    public static function notFound($moduleClass) {
36
        return new self(self::MESSAGE_MODULE_INVALID, $moduleClass);
37
    }
38
39
    public function __construct($message = "", $className, $code = 0, Exception $previous = NULL) {
40
        $this->moduleClass = $className;
41
42
        parent::__construct($message, $code, $previous);
43
    }
44
45
    /**
46
     * Return the module FQCN.
47
     *
48
     * @return string
49
     */
50
    public function getModuleClass() {
51
        return $this->moduleClass;
52
    }
53
54
}
55