phpmyadmin/libraries/classes/Controllers/LogoutController.php
Maurício Meneghini Fauth 785f8c1c00
Use constructor property promotion where possible
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2023-02-20 19:39:02 -03:00

29 lines
624 B
PHP

<?php
declare(strict_types=1);
namespace PhpMyAdmin\Controllers;
use PhpMyAdmin\Core;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\Plugins\AuthenticationPluginFactory;
class LogoutController
{
public function __construct(private AuthenticationPluginFactory $authPluginFactory)
{
}
public function __invoke(ServerRequest $request): void
{
if (! $request->isPost() || $GLOBALS['token_mismatch']) {
Core::sendHeaderLocation('./index.php?route=/');
return;
}
$authPlugin = $this->authPluginFactory->create();
$authPlugin->logOut();
}
}