src/EnumMap.php 1 location
|
@@ 85-90 (lines=6) @@
|
| 82 |
|
*/ |
| 83 |
|
public function __construct($enumeration, $flags = null) |
| 84 |
|
{ |
| 85 |
|
if (!is_subclass_of($enumeration, __NAMESPACE__ . '\Enum')) { |
| 86 |
|
throw new InvalidArgumentException(sprintf( |
| 87 |
|
"This EnumMap can handle subclasses of '%s' only", |
| 88 |
|
__NAMESPACE__ . '\Enum' |
| 89 |
|
)); |
| 90 |
|
} |
| 91 |
|
$this->enumeration = $enumeration; |
| 92 |
|
|
| 93 |
|
if ($flags !== null) { |
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()); |