InternalNameException::__toString()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Source\Core\Exception;
4
5
use Exception;
6
7
final class InternalNameException extends Exception implements ExceptionInterface
8
{
9
    /**
10
     * Exception message
11
     */
12
    protected $message = "";
13
14
    /**
15
     * Unknown
16
     */
17
    private $string;
0 ignored issues
show
introduced by
The private property $string is not used, and could be removed.
Loading history...
18
19
    /**
20
     * User-defined exception code
21
     */
22
    protected $code = 0;
23
24
    /**
25
     * Source filename of exception
26
     */
27
    protected $file;
28
29
    /**
30
     * Source line of exception
31
     */
32
    protected $line;
33
34
    /**
35
     * Unknown
36
     */
37
    private $trace;
0 ignored issues
show
introduced by
The private property $trace is not used, and could be removed.
Loading history...
38
39
    /**
40
     * @var string $message
41
     * @var int $code
42
     */
43
    public function __construct(string $message = null, int $code = 0)
44
    {
45
        if (!$message) {
46
            throw new $this('Unknown ' . get_class($this));
47
        }
48
49
        parent::__construct($message, $code);
50
    }
51
52
    public function __toString()
53
    {
54
        return get_class($this) . " '{$this->message}' in {$this->file}({$this->line})\n" . "{$this->getTraceAsString()}";
55
    }
56
}
57