UnhandledEnumException   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A enum() 0 3 1
A __construct() 0 8 1
A enumFqn() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zlikavac32\Enum;
6
7
use LogicException;
8
9
class UnhandledEnumException extends LogicException
10
{
11
12
    private Enum $enum;
13
    private string $enumFqn;
14
15
    public function __construct(Enum $enum)
16
    {
17
        $fqn = get_parent_class($enum);
18
19
        parent::__construct(sprintf('Enum %s::%s() is left unhandled', $fqn, $enum->name()));
20
21
        $this->enum = $enum;
22
        $this->enumFqn = $fqn;
23
    }
24
25
    public function enum(): Enum
26
    {
27
        return $this->enum;
28
    }
29
30
    public function enumFqn(): string
31
    {
32
        return $this->enumFqn;
33
    }
34
}
35