value & $classMask; } public function toMask() : int { return 1 << ($this->value - 1); } public static function fromMask(int $classMask = self::MASK_ALL) : array { $x = []; foreach (self::cases() as $cl) if ($cl->toMask() & $classMask) $x[] = $cl->value; return $x; } public function json() : string { return match ($this) { self::WARRIOR => 'warrior', self::PALADIN => 'paladin', self::HUNTER => 'hunter', self::ROGUE => 'rogue', self::PRIEST => 'priest', self::DEATHKNIGHT => 'deathknight', self::SHAMAN => 'shaman', self::MAGE => 'mage', self::WARLOCK => 'warlock', self::DRUID => 'druid' }; } public function spellFamily() : int { return match ($this) { self::WARRIOR => SPELLFAMILY_WARRIOR, self::PALADIN => SPELLFAMILY_PALADIN, self::HUNTER => SPELLFAMILY_HUNTER, self::ROGUE => SPELLFAMILY_ROGUE, self::PRIEST => SPELLFAMILY_PRIEST, self::DEATHKNIGHT => SPELLFAMILY_DEATHKNIGHT, self::SHAMAN => SPELLFAMILY_SHAMAN, self::MAGE => SPELLFAMILY_MAGE, self::WARLOCK => SPELLFAMILY_WARLOCK, self::DRUID => SPELLFAMILY_DRUID }; } } ?>