diff --git a/src/Api/Jobs/UserJobs/EditUserAccessRankJob.php b/src/Api/Jobs/UserJobs/EditUserAccessRankJob.php index c3f4d7cb..7a975763 100644 --- a/src/Api/Jobs/UserJobs/EditUserAccessRankJob.php +++ b/src/Api/Jobs/UserJobs/EditUserAccessRankJob.php @@ -25,7 +25,7 @@ class EditUserAccessRankJob extends AbstractJob Logger::log('{user} changed {subject}\'s access rank to {rank}', [ 'user' => TextHelper::reprUser(Auth::getCurrentUser()), 'subject' => TextHelper::reprUser($user), - 'rank' => $newAccessRank->toString()]); + 'rank' => $newAccessRank->toDisplayString()]); return $user; } diff --git a/src/Enum.php b/src/Enums/AbstractEnum.php similarity index 60% rename from src/Enum.php rename to src/Enums/AbstractEnum.php index 5feb460a..907f5fb6 100644 --- a/src/Enum.php +++ b/src/Enums/AbstractEnum.php @@ -1,19 +1,12 @@ getConstants(); - return array_search($constant, $constants); - } - public function toDisplayString() { return TextCaseConverter::convert($this->toString(), - TextCaseConverter::CAMEL_CASE, + TextCaseConverter::SPINAL_CASE, TextCaseConverter::BLANK_CASE); } diff --git a/src/Models/Enums/AccessRank.php b/src/Enums/AccessRank.php similarity index 63% rename from src/Models/Enums/AccessRank.php rename to src/Enums/AccessRank.php index 2216a1cf..42ce194f 100644 --- a/src/Models/Enums/AccessRank.php +++ b/src/Enums/AccessRank.php @@ -1,5 +1,5 @@ accessRank); + switch ($this->accessRank) + { + case self::Anonymous: return 'anonymous'; + case self::Registered: return 'registered'; + case self::PowerUser: return 'power-user'; + case self::Moderator: return 'moderator'; + case self::Admin: return 'admin'; + case self::Nobody: return 'nobody'; + } + return null; } public static function getAll() diff --git a/src/Enums/IEnum.php b/src/Enums/IEnum.php new file mode 100644 index 00000000..2e0cecd8 --- /dev/null +++ b/src/Enums/IEnum.php @@ -0,0 +1,6 @@ +type); + switch ($this->type) + { + case self::Image: return 'image'; + case self::Flash: return 'flash'; + case self::Youtube: return 'youtube'; + case self::Video: return 'video'; + } + return null; } public function validate() diff --git a/src/Models/Enums/Privilege.php b/src/Enums/Privilege.php similarity index 94% rename from src/Models/Enums/Privilege.php rename to src/Enums/Privilege.php index 00858bcb..478ba8fd 100644 --- a/src/Models/Enums/Privilege.php +++ b/src/Enums/Privilege.php @@ -1,5 +1,5 @@ secondary; return $string; } + + public function toDisplayString() + { + return $this->toString(); + } }