Conditions | 3 |
Paths | 3 |
Total Lines | 10 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 3 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
36 | 4 | protected function __construct($value) |
|
37 | { |
||
38 | 4 | if (empty(static::$values)) { |
|
39 | 1 | throw new InvalidEnumSetupException('Incorrect setup! Enum '.get_called_class().' doesn\'t have its static::$values set.'); |
|
40 | } |
||
41 | 3 | if (!in_array($value, static::$values)) { |
|
42 | 2 | throw new InvalidEnumValueException('Enum '.get_called_class().'does not contain value '.$value.'. Possible values are: '.implode(', ', static::$values)); |
|
43 | } |
||
44 | 1 | $this->value = $value; |
|
45 | 1 | } |
|
46 | |||
80 |