Completed
Push — master ( 75ec1b...02ab52 )
by Carlos C
02:40
created

GenericOverrideException   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 10
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Eclipxe\Enum\Exceptions;
6
7
use OutOfRangeException;
8
use Throwable;
9
10
class GenericOverrideException extends OutOfRangeException implements EnumExceptionInterface
11
{
12
    protected const TYPE_NAME = '';
13
14 4
    public static function create(string $className, string $value, Throwable $previous = null)
15
    {
16
        // StatusEnum cannot override value to x
17 4
        return new static(sprintf('%s cannot override %s to %s', $className, static::TYPE_NAME, $value), 0, $previous);
18
    }
19
}
20