Blame view

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