1
0
mirror of https://github.com/phpmyadmin/phpmyadmin.git synced 2026-10-25 06:39:48 +03:00
Files
phpmyadmin/src/Controllers/LogoutController.php
Maurício Meneghini Fauth 43f54d4578 Extract ResponseRenderer dependency from LogoutController
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
2026-02-14 15:30:59 -03:00

35 lines
869 B
PHP

<?php
declare(strict_types=1);
namespace PhpMyAdmin\Controllers;
use PhpMyAdmin\Http\Response;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\Plugins\AuthenticationPluginFactory;
use PhpMyAdmin\ResponseRenderer;
use PhpMyAdmin\Routing\Route;
#[Route('/logout', ['GET', 'POST'])]
final readonly class LogoutController implements InvocableController
{
public function __construct(
private AuthenticationPluginFactory $authPluginFactory,
private ResponseRenderer $responseRenderer,
) {
}
public function __invoke(ServerRequest $request): Response
{
if (! $request->isPost()) {
$this->responseRenderer->redirect('./index.php?route=/');
return $this->responseRenderer->response();
}
$authPlugin = $this->authPluginFactory->create();
return $authPlugin->logOut();
}
}