<?php namespace Slovocast\Controller\User; use Slovocast\Controller\Controller; use Psr\Http\Message\ResponseInterface as Response; use Odan\Session\SessionInterface; class LogoutUserAction extends Controller { public function __construct( protected SessionInterface $session ) { } public function handle(): Response { if ($this->session->has('user')) { $this->session->delete('user'); } return $this->redirect('/', 302); } }