AdvisorController.php 838 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. declare(strict_types=1);
  3. namespace PhpMyAdmin\Controllers\Server\Status;
  4. use PhpMyAdmin\Advisor;
  5. use PhpMyAdmin\Response;
  6. use PhpMyAdmin\Server\Status\Data;
  7. use PhpMyAdmin\Template;
  8. /**
  9. * Displays the advisor feature
  10. */
  11. class AdvisorController extends AbstractController
  12. {
  13. /** @var Advisor */
  14. private $advisor;
  15. /**
  16. * @param Response $response
  17. * @param Data $data
  18. */
  19. public function __construct($response, Template $template, $data, Advisor $advisor)
  20. {
  21. parent::__construct($response, $template, $data);
  22. $this->advisor = $advisor;
  23. }
  24. public function index(): void
  25. {
  26. $data = [];
  27. if ($this->data->dataLoaded) {
  28. $data = $this->advisor->run();
  29. }
  30. $this->render('server/status/advisor/index', ['data' => $data]);
  31. }
  32. }