| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
namespace MyGame\Example; |
| 5 |
|
| 6 |
class Any |
| 7 |
{ |
| 8 |
const NONE = 0; |
| 9 |
const Monster = 1; |
| 10 |
const TestSimpleTableWithEnum = 2; |
| 11 |
const MyGame_Example2_Monster = 3; |
| 12 |
|
| 13 |
private static $names = array( |
| 14 |
Any::NONE=>"NONE", |
| 15 |
Any::Monster=>"Monster", |
| 16 |
Any::TestSimpleTableWithEnum=>"TestSimpleTableWithEnum", |
| 17 |
Any::MyGame_Example2_Monster=>"MyGame_Example2_Monster", |
| 18 |
); |
| 19 |
|
| 20 |
public static function Name($e) |
| 21 |
{ |
| 22 |
if (!isset(self::$names[$e])) { |
| 23 |
throw new \Exception(); |
| 24 |
} |
| 25 |
return self::$names[$e]; |
| 26 |
} |
| 27 |
} |