/** * Handles a POST request to configure the javascript ticker */ public function configureJavascriptTickerAction() { $tickerEnabled = $this->bodyParam('enabled'); $tickerInterval = $this->bodyParam('interval'); if (!is_bool($tickerEnabled)) { return new ApiProblemResponse(new ApiProblem(422, $this->translator->translate('The enabled flag should be a boolean value'))); } if (!is_int($tickerInterval) || $tickerInterval <= 0) { return new ApiProblemResponse(new ApiProblem(422, $this->translator->translate('The ticker interval should greater than zero'))); } $this->commandBus->dispatch(ConfigureJavascriptTicker::set($tickerEnabled, $tickerInterval, ConfigLocation::fromPath(Definition::getSystemConfigDir()))); return ['success' => true]; }