AbstractController.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Holds the PhpMyAdmin\Controllers\Setup\AbstractController
  5. *
  6. * @package PhpMyAdmin\Controllers\Setup
  7. */
  8. declare(strict_types=1);
  9. namespace PhpMyAdmin\Controllers\Setup;
  10. use PhpMyAdmin\Config\ConfigFile;
  11. use PhpMyAdmin\Config\Forms\BaseForm;
  12. use PhpMyAdmin\Config\Forms\Setup\SetupFormList;
  13. use PhpMyAdmin\Template;
  14. /**
  15. * Class AbstractController
  16. * @package PhpMyAdmin\Controllers\Setup
  17. */
  18. abstract class AbstractController
  19. {
  20. /**
  21. * @var ConfigFile
  22. */
  23. protected $config;
  24. /**
  25. * @var Template
  26. */
  27. protected $template;
  28. /**
  29. * AbstractController constructor.
  30. *
  31. * @param ConfigFile $config ConfigFile instance
  32. * @param Template $template Template instance
  33. */
  34. public function __construct($config, $template)
  35. {
  36. $this->config = $config;
  37. $this->template = $template;
  38. }
  39. /**
  40. * @return array
  41. */
  42. protected function getPages(): array
  43. {
  44. $ignored = [
  45. 'Config',
  46. 'Servers',
  47. ];
  48. $pages = [];
  49. foreach (SetupFormList::getAll() as $formset) {
  50. if (in_array($formset, $ignored)) {
  51. continue;
  52. }
  53. /** @var BaseForm $formClass */
  54. $formClass = SetupFormList::get($formset);
  55. $pages[$formset] = [
  56. 'name' => $formClass::getName(),
  57. 'formset' => $formset,
  58. ];
  59. }
  60. return $pages;
  61. }
  62. }