Green phase: execute() accepts ?string, returns early for null or empty string, otherwise delegates to repository.
22 lines
386 B
PHP
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);
|
|
}
|
|
}
|