src/EnumMap.php 1 location
|
@@ 30-35 (lines=6) @@
|
| 27 |
|
*/ |
| 28 |
|
public function __construct($enumeration) |
| 29 |
|
{ |
| 30 |
|
if (!is_subclass_of($enumeration, __NAMESPACE__ . '\Enum')) { |
| 31 |
|
throw new InvalidArgumentException(sprintf( |
| 32 |
|
"This EnumMap can handle subclasses of '%s' only", |
| 33 |
|
__NAMESPACE__ . '\Enum' |
| 34 |
|
)); |
| 35 |
|
} |
| 36 |
|
$this->enumeration = $enumeration; |
| 37 |
|
} |
| 38 |
|
|
src/EnumSet.php 1 location
|
@@ 50-55 (lines=6) @@
|
| 47 |
|
*/ |
| 48 |
|
public function __construct($enumeration) |
| 49 |
|
{ |
| 50 |
|
if (!is_subclass_of($enumeration, __NAMESPACE__ . '\Enum')) { |
| 51 |
|
throw new InvalidArgumentException(sprintf( |
| 52 |
|
"This EnumSet can handle subclasses of '%s' only", |
| 53 |
|
__NAMESPACE__ . '\Enum' |
| 54 |
|
)); |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
$this->enumeration = $enumeration; |
| 58 |
|
$this->ordinalMax = count($enumeration::getConstants()); |