phpmyadmin/libraries/classes/Controllers/ThemesController.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

27 lines
735 B
PHP

<?php
declare(strict_types=1);
namespace PhpMyAdmin\Controllers;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\ResponseRenderer;
use PhpMyAdmin\Template;
use PhpMyAdmin\ThemeManager;
class ThemesController extends AbstractController
{
public function __construct(ResponseRenderer $response, Template $template, private ThemeManager $themeManager)
{
parent::__construct($response, $template);
}
public function __invoke(ServerRequest $request): void
{
$themes = $this->themeManager->getThemesArray();
$themesList = $this->template->render('home/themes', ['themes' => $themes]);
$this->response->setAjax(true);
$this->response->addJSON('themes', $themesList);
}
}