InvoiceStatus.php
Pfad: src/Domain/Rechnung/InvoiceStatus.php
Ext: php
Größe: 2110 Bytes
Geändert: 2026-07-16 14:10:13+02
<?php
declare(strict_types=1);
namespace Demo\Domain\Rechnung;
/**
* Prozess-Statuswerte des Rechnungs-Laufes.
*/
final class InvoiceStatus
{
public const NEW = 'NEW';
public const DISCOVERED = 'DISCOVERED';
public const DOWNLOADED = 'DOWNLOADED';
public const EXTRACTED = 'EXTRACTED';
public const CONTACT_RESOLVED = 'CONTACT_RESOLVED';
public const POSTING = 'POSTING';
public const POSTED = 'POSTED';
public const DONE_NO_WORK = 'DONE_NO_WORK';
public const DONE_WITH_WARNINGS = 'DONE_WITH_WARNINGS';
public const DONE = 'DONE';
public const DONE_PARTIAL = 'DONE_PARTIAL';
public const ERROR_AUTH = 'ERROR_AUTH';
public const ERROR_DOWNLOAD = 'ERROR_DOWNLOAD';
public const ERROR_EXTRACT = 'ERROR_EXTRACT';
public const ERROR_VENDOR_MATCH = 'ERROR_VENDOR_MATCH';
public const ERROR_POSTING = 'ERROR_POSTING';
/** @var list<string> */
private const SUCCESS = [
self::DONE_NO_WORK,
self::DONE,
self::DONE_WITH_WARNINGS,
self::DONE_PARTIAL,
self::POSTED,
];
/** @var list<string> */
private const ERROR = [
self::ERROR_AUTH,
self::ERROR_DOWNLOAD,
self::ERROR_EXTRACT,
self::ERROR_VENDOR_MATCH,
self::ERROR_POSTING,
];
/**
* @param string $status Statuswert.
* @return bool True, wenn ein terminaler Endzustand vorliegt.
*/
public static function isTerminal(string $status): bool
{
return in_array($status, self::SUCCESS, true) || in_array($status, self::ERROR, true);
}
/**
* @param string $status Statuswert.
* @return bool True, wenn der Status als Fehlerzustand zu interpretieren ist.
*/
public static function isError(string $status): bool
{
return in_array($status, self::ERROR, true);
}
/**
* @param string $status Statuswert.
* @return bool True, wenn der Status als erfolgreicher Endzustand gilt.
*/
public static function isSuccess(string $status): bool
{
return in_array($status, self::SUCCESS, true);
}
}