|
@@ 33-40 (lines=8) @@
|
| 30 |
|
]; |
| 31 |
|
} |
| 32 |
|
|
| 33 |
|
public function get(string $className, $value): EnumInterface |
| 34 |
|
{ |
| 35 |
|
if (!is_a($className, EnumInterface::class, true)) { |
| 36 |
|
throw new InvalidArgumentException(sprintf('"%s" is not an "%s".', $className, EnumInterface::class)); |
| 37 |
|
} |
| 38 |
|
|
| 39 |
|
return \call_user_func([$className, 'get'], $value); |
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
public function values(string $className): array |
| 43 |
|
{ |
|
@@ 42-49 (lines=8) @@
|
| 39 |
|
return \call_user_func([$className, 'get'], $value); |
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
public function values(string $className): array |
| 43 |
|
{ |
| 44 |
|
if (!is_a($className, EnumInterface::class, true)) { |
| 45 |
|
throw new InvalidArgumentException(sprintf('"%s" is not an "%s".', $className, EnumInterface::class)); |
| 46 |
|
} |
| 47 |
|
|
| 48 |
|
return \call_user_func([$className, 'values']); |
| 49 |
|
} |
| 50 |
|
|
| 51 |
|
public function accepts(string $className, $value): bool |
| 52 |
|
{ |
|
@@ 51-58 (lines=8) @@
|
| 48 |
|
return \call_user_func([$className, 'values']); |
| 49 |
|
} |
| 50 |
|
|
| 51 |
|
public function accepts(string $className, $value): bool |
| 52 |
|
{ |
| 53 |
|
if (!is_a($className, EnumInterface::class, true)) { |
| 54 |
|
throw new InvalidArgumentException(sprintf('"%s" is not an "%s".', $className, EnumInterface::class)); |
| 55 |
|
} |
| 56 |
|
|
| 57 |
|
return \call_user_func([$className, 'accepts'], $value); |
| 58 |
|
} |
| 59 |
|
|
| 60 |
|
public function instances(string $className): array |
| 61 |
|
{ |
|
@@ 60-67 (lines=8) @@
|
| 57 |
|
return \call_user_func([$className, 'accepts'], $value); |
| 58 |
|
} |
| 59 |
|
|
| 60 |
|
public function instances(string $className): array |
| 61 |
|
{ |
| 62 |
|
if (!is_a($className, EnumInterface::class, true)) { |
| 63 |
|
throw new InvalidArgumentException(sprintf('"%s" is not an "%s".', $className, EnumInterface::class)); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
return \call_user_func([$className, 'instances']); |
| 67 |
|
} |
| 68 |
|
|
| 69 |
|
public function readables(string $className): array |
| 70 |
|
{ |
|
@@ 69-76 (lines=8) @@
|
| 66 |
|
return \call_user_func([$className, 'instances']); |
| 67 |
|
} |
| 68 |
|
|
| 69 |
|
public function readables(string $className): array |
| 70 |
|
{ |
| 71 |
|
if (!is_a($className, ReadableEnumInterface::class, true)) { |
| 72 |
|
throw new InvalidArgumentException(sprintf('"%s" is not a "%s".', $className, ReadableEnumInterface::class)); |
| 73 |
|
} |
| 74 |
|
|
| 75 |
|
return \call_user_func([$className, 'readables']); |
| 76 |
|
} |
| 77 |
|
|
| 78 |
|
public function readableFor(string $className, $value): string |
| 79 |
|
{ |
|
@@ 78-85 (lines=8) @@
|
| 75 |
|
return \call_user_func([$className, 'readables']); |
| 76 |
|
} |
| 77 |
|
|
| 78 |
|
public function readableFor(string $className, $value): string |
| 79 |
|
{ |
| 80 |
|
if (!is_a($className, ReadableEnumInterface::class, true)) { |
| 81 |
|
throw new InvalidArgumentException(sprintf('"%s" is not a "%s".', $className, ReadableEnumInterface::class)); |
| 82 |
|
} |
| 83 |
|
|
| 84 |
|
return \call_user_func([$className, 'readableFor'], $value); |
| 85 |
|
} |
| 86 |
|
} |
| 87 |
|
|