This repository has been archived on 2025-02-26. You can view files and clone it, but cannot push or open issues or pull requests.
szurubooru/src/Enum.php
2013-10-08 22:59:32 +02:00

17 lines
366 B
PHP

<?php
class Enum
{
public static function toString($constant)
{
$cls = new ReflectionClass(get_called_class());
$constants = $cls->getConstants();
return array_search($constant, $constants);
}
public static function getAll()
{
$cls = new ReflectionClass(get_called_class());
$constants = $cls->getConstants();
return array_values($constants);
}
}