Completed
Push — master ( 39eeee...3177f2 )
by Tom
10s
created

InvalidNameException::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 10
Ratio 100 %

Importance

Changes 0
Metric Value
dl 10
loc 10
rs 9.9332
c 0
b 0
f 0
cc 2
nc 2
nop 2
1
<?php
2
3
namespace Spatie\Enum\Exceptions;
4
5
use InvalidArgumentException;
6
7 View Code Duplication
class InvalidNameException extends InvalidArgumentException
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
    public function __construct($name, string $class)
10
    {
11
        $message = 'The name for an enum must be a string but '.gettype($name).' given';
12
13
        if (is_string($name)) {
14
            $message = 'The given name ['.$name.'] is not available in this enum '.$class;
15
        }
16
17
        parent::__construct($message);
18
    }
19
}
20