Rabbi_Gerzi/backend/app/Auth/UseCases/Logout/Logout.php
Yisroel Baum c6306af73b
implement: move null/empty token guard into logout use case
Green phase: execute() accepts ?string, returns early for null or empty string, otherwise delegates to repository.
2026-05-17 10:09:31 +03:00

22 lines
386 B
PHP

<?php
namespace App\Auth\UseCases\Logout;
use App\Auth\SessionRepository;
class Logout
{
public function __construct(
private SessionRepository $sessionRepo,
) {
}
public function execute(?string $token): void
{
if (! is_string($token) || $token === '') {
return;
}
$this->sessionRepo->deleteByToken($token);
}
}