REFACTORING: use BaseEnumeration

Classes UserRoles and UserStates are now using new BaseEnumeration class.
This commit is contained in:
Michal Kváček
2016-01-26 11:13:02 +01:00
parent 0ef7a12691
commit 2cf9fcae3d
2 changed files with 12 additions and 56 deletions
+2 -24
View File
@@ -3,33 +3,11 @@ namespace App\Enumerations;
use App\Models\User;
class UserRoles
class UserRoles extends BaseEnumeration
{
/**
* Getter for roles
*
* This method returns only list of roles as inserted into database
*
* @return array
*/
public static function getSimple()
{
return array_values(self::getWithTranslations());
}
/**
* Getter for roles with translations
*
* This method returns all user roles as keys. Values are strings used for translations.
*
* @return array
*/
public static function getWithTranslations()
{
return [
public static $items = [
User::ROLE_ADMIN => 'admin/userManagement.role_' . User::ROLE_ADMIN,
User::ROLE_EDITOR => 'admin/userManagement.role_' . User::ROLE_EDITOR,
User::ROLE_VISITOR => 'admin/userManagement.role_' . User::ROLE_VISITOR
];
}
}
+2 -24
View File
@@ -10,33 +10,11 @@ namespace App\Enumerations;
use App\Models\User;
class UserStates
class UserStates extends BaseEnumeration
{
/**
* Getter for states
*
* This method returns only list of roles as inserted into database
*
* @return array
*/
public static function getSimple()
{
return array_values(self::getWithTranslations());
}
/**
* Getter for states with translations
*
* This method returns all user states as keys. Values are strings used for translations.
*
* @return array
*/
public static function getWithTranslations()
{
return [
public static $items = [
User::STATE_DELETED => 'admin/userManagement.status_' . User::STATE_DELETED,
User::STATE_BLOCKED => 'admin/userManagement.status_' . User::STATE_BLOCKED,
User::STATE_ACTIVE => 'admin/userManagement.status_' . User::STATE_ACTIVE
];
}
}