Files
alrahma_sunday_school/app/Support/SchoolYear/SchoolYearStatus.php
T
root e06ccc9cc0
Tests / PHPUnit (push) Failing after 40s
ADD SCHOOL YEAR MANAGEMENT
2026-07-12 02:21:39 -04:00

39 lines
965 B
PHP

<?php
namespace App\Support\SchoolYear;
final class SchoolYearStatus
{
public const DRAFT = 'draft';
public const ACTIVE = 'active';
public const CLOSING = 'closing';
public const CLOSED = 'closed';
public const ARCHIVED = 'archived';
public const ALL = [
self::DRAFT,
self::ACTIVE,
self::CLOSING,
self::CLOSED,
self::ARCHIVED,
];
public const TRANSITIONS = [
self::DRAFT => [self::ACTIVE],
self::ACTIVE => [self::CLOSING],
self::CLOSING => [self::ACTIVE, self::CLOSED],
self::CLOSED => [self::ACTIVE, self::ARCHIVED],
self::ARCHIVED => [],
];
public static function canTransition(string $from, string $to): bool
{
return in_array($to, self::TRANSITIONS[$from] ?? [], true);
}
public static function isReadonly(string $status): bool
{
return in_array($status, [self::CLOSED, self::ARCHIVED], true);
}
}