Initial commit

This commit is contained in:
2026-02-06 23:26:56 +07:00
commit d6022b9bca
92 changed files with 41386 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?php
namespace App\Enums;
use Symfony\Component\HttpFoundation\Response;
enum LoginError
{
case INVALID_CREDENTIALS;
case SERVER_ERROR;
public function httpStatusCode(): int
{
return match ($this) {
self::INVALID_CREDENTIALS => Response::HTTP_UNAUTHORIZED,
self::SERVER_ERROR => Response::HTTP_INTERNAL_SERVER_ERROR,
};
}
public function message(): string
{
return match ($this) {
self::INVALID_CREDENTIALS => 'Invalid credentials',
self::SERVER_ERROR => 'Authentication failed',
};
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Enums;
enum TaskStatus: string
{
case PENDING = 'pending';
case IN_PROGRESS = 'in_progress';
case COMPLETED = 'completed';
public static function values(): array
{
return array_map(fn($case) => $case->value, self::cases());
}
public static function options(): array
{
return [
self::PENDING->value => 'В ожидании',
self::IN_PROGRESS->value => 'В процессе',
self::COMPLETED->value => 'Завершена',
];
}
public function label(): string
{
return match ($this) {
self::PENDING => 'В ожидании',
self::IN_PROGRESS => 'В процессе',
self::COMPLETED => 'Завершена',
};
}
public function isCompleted(): bool
{
return $this === self::COMPLETED;
}
}