ResultStatus.php

Code Hygiene Score: 100

Keine Issues gefunden.

Klassen 1

Funktionen 3

Verwendet von 3

Code

<?php

declare(strict_types=1);

namespace Domain\ValueObject;

// @responsibility: Enum für Task-Result Status

enum ResultStatus: string
{
    case SUCCESS = 'success';
    case ERROR = 'error';
    case PARTIAL = 'partial';

    public function isSuccess(): bool
    {
        return $this === self::SUCCESS;
    }

    public function isError(): bool
    {
        return $this === self::ERROR;
    }

    public function label(): string
    {
        return match ($this) {
            self::SUCCESS => 'Erfolgreich',
            self::ERROR => 'Fehler',
            self::PARTIAL => 'Teilweise',
        };
    }
}
← Übersicht Graph