moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class); } /** * PSR Request Object * * @var ServerRequestInterface */ protected $request; /** * Central Request Dispatcher * * @param ServerRequestInterface $request PSR7 Request Object * @param ResponseInterface $response PSR7 Response Object * * @return ResponseInterface * * @throws \InvalidArgumentException In case an action is not callable */ public function processRequest(ServerRequestInterface $request, ResponseInterface $response) { $methodName = $request->getQueryParams()['action'] ?: 'index'; if (!is_callable([$this, $methodName])) { throw new \InvalidArgumentException( 'The method "' . $methodName . '" is not callable within "' . static::class . '".', 1442736343 ); } return $this->{$methodName}($request, $response); } }