. */ declare(strict_types=1); namespace Fisharebest\Webtrees\Http\Middleware; use Fisharebest\Webtrees\Module\ModuleThemeInterface; use Fisharebest\Webtrees\Services\ModuleService; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\MiddlewareInterface; use Psr\Http\Server\RequestHandlerInterface; /** * Middleware to bootstrap the modules. */ class BootModules implements MiddlewareInterface { private ModuleService $module_service; private ModuleThemeInterface $theme; /** * BootModules constructor. * * @param ModuleService $module_service * @param ModuleThemeInterface $theme */ public function __construct(ModuleService $module_service, ModuleThemeInterface $theme) { $this->module_service = $module_service; $this->theme = $theme; } /** * @param ServerRequestInterface $request * @param RequestHandlerInterface $handler * * @return ResponseInterface */ public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface { $this->module_service->bootModules($this->theme); return $handler->handle($request); } }