Commit 3b95c5dd07157d04b44c2f78a382fcab5af6f172

Authored by Андрей Ларионов
Exists in master

Merge branch 'master' of http://gitlab.nologostudio.ru/alarionov/rekamore-su

Showing 1 changed file Inline Diff

app/Enums/WorkerStatuses.php
1 <?php 1 <?php
2 2
3 namespace App\Enums; 3 namespace App\Enums;
4 4
5 use App\Enums\EnumTraits\EnumToArray; 5 use App\Enums\EnumTraits\EnumToArray;
6 6
7 enum WorkerStatuses: int 7 enum WorkerStatuses: int
8 { 8 {
9 use EnumToArray; 9 use EnumToArray;
10 10
11 case NotIndicated = 1; 11 case NotIndicated = 1;
12 case LookingForWork = 0; 12 case LookingForWork = 0;
13 case NotLookingForWork = 2; 13 case NotLookingForWork = 2;
14 case ConsideringOffers = 3; 14 case ConsideringOffers = 3;
15 15
16 public function label(): string 16 public function label(): string
17 { 17 {
18 return match($this) 18 return match($this)
19 { 19 {
20 self::LookingForWork => 'Ищу работу', 20 self::LookingForWork => 'Ищу работу',
21 self::NotIndicated => 'Не указано', 21 self::NotIndicated => 'Не указано',
22 self::NotLookingForWork => 'Не ищу работу', 22 self::NotLookingForWork => 'Не ищу работу',
23 self::ConsideringOffers => 'Рассматриваю предложения', 23 self::ConsideringOffers => 'Рассматриваю предложения',
24 }; 24 };
25 } 25 }
26 26
27 public static function getWorkerStatuses(): array { 27 public static function getWorkerStatuses(): array {
28 $statuses = self::cases(); 28 $statuses = self::cases();
29 29
30 $result = []; 30 $result = [];
31 foreach ($statuses as $status) { 31 foreach ($statuses as $status) {
32 $result[$status->value] = $status->label(); 32 $result[$status->value] = $status->label();
33 } 33 }
34 return $result; 34 return $result;
35 } 35 }
36 } 36 }
37 37