WorkerStatuses.php 862 Bytes
<?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 {
        $statuses = self::cases();

        $result = [];
        foreach ($statuses as $status) {
            $result[$status->value] = $status->label();
        }
        return $result;
    }
}