public static function fromName($db) { foreach (RankTypes::getAllTypes() as $id) { $rank = RankTypes::fromID($id); if ($rank != null) { if ($rank->getName() == $db) { return $rank; } } } return null; }