UsageDimensionsEnum.php
1 <?php 2 3 namespace App\Enums; 4 5 enum UsageDimensionsEnum: string 6 { 7 case CONTROLACCESS = 'Control access to devices and systems'; 8 case Biometric = 'Biometric systems and devices'; 9 case BOUNDARY = 'Boundary protection devices and systems'; 10 case PROTERCTDATA = 'Protect data(devices and systems)'; 11 case BUILDDATABASES = 'Build maintain Data Bases'; 12 case SMARTCARDS = 'ICs, smart cards and smart card and related devices'; 13 case KEYMANAGMENT = 'Key Management Systems'; 14 case REINFORCE = 'Reinforce Mobility'; 15 case MULTIFUNCTION = 'Multifunction devices'; 16 case NETWORK = 'Allow Network and network related devices and systems'; 17 case OS = 'Operating Systems'; 18 case DIGITALSIGNATURES = 'Product for Digital Signatures'; 19 case TRUSTEDCOMPUTING = 'Trusted Computing'; 20 case SMARTMETERS = 'Smart meters'; 21 case OTHER = 'Other Devices and systems'; 22 case NONE = 'None'; 23 24 public static function toArray() 25 { 26 return array_column(UsageDimensionsEnum::cases(), 'value'); 27 } 28 29 public static function valueNameArray(): array 30 { 31 return collect(self::cases())->map(function ($usageDimension) { 32 return [ 33 'id' => $usageDimension->value, 34 'name' => self::getTranslation($usageDimension->name), 35 ]; 36 })->toArray(); 37 } 38 39 public static function getTranslation(string $key) 40 { 41 return match ($key) { 42 'CONTROLACCESS' => __('toes.usage_dimensions.control_access'), 43 'Biometric' => __('toes.usage_dimensions.biometric'), 44 'BOUNDARY' => __('toes.usage_dimensions.boundary'), 45 'PROTERCTDATA' => __('toes.usage_dimensions.protect_data'), 46 'BUILDDATABASES' => __('toes.usage_dimensions.build_databases'), 47 'SMARTCARDS' => __('toes.usage_dimensions.smartcards'), 48 'KEYMANAGMENT' => __('toes.usage_dimensions.key_management'), 49 'REINFORCE' => __('toes.usage_dimensions.reinforce'), 50 'MULTIFUNCTION' => __('toes.usage_dimensions.multifunction'), 51 'NETWORK' => __('toes.usage_dimensions.network'), 52 'OS' => __('toes.usage_dimensions.os'), 53 'DIGITALSIGNATURES' => __('toes.usage_dimensions.digital_signatures'), 54 'TRUSTEDCOMPUTING' => __('toes.usage_dimensions.trusted_computing'), 55 'SMARTMETERS' => __('toes.usage_dimensions.smart_meters'), 56 'OTHER' => __('toes.usage_dimensions.other'), 57 'NONE' => __('toes.usage_dimensions.none'), 58 default => '', 59 }; 60 } 61 62 public static function getTranslationByValue(string $value) 63 { 64 $key = array_search($value, array_column(UsageDimensionsEnum::cases(), 'value', 'name')); 65 return self::getTranslation($key); 66 } 67 }