22declare(strict_types=1);
46 protected static function register(
self $member) : void{
47 self::_registryRegister($member->name(), $member);
50 protected static function registerAll(
self ...$members) : void{
51 foreach($members as $member){
63 public static function getAll() : array{
66 $result = self::_registryGetAll();
71 private static $nextId =
null;
81 private function __construct(
string $enumName){
82 self::verifyName($enumName);
83 $this->enumName = $enumName;
84 if(self::$nextId ===
null){
85 self::$nextId = Process::pid();
87 $this->runtimeId = self::$nextId++;
90 public function name() : string{
91 return $this->enumName;
99 public function id() : int{
100 return $this->runtimeId;
106 public function equals(
self $other) : bool{
107 return $this->enumName === $other->enumName;
static register(self $member)