src/FlexApp/Service/ParametersGenerator.php line 22

Open in your IDE?
  1. <?php
  2. namespace FlexApp\Service;
  3. use Exception;
  4. use WebBundle\Service\CommonDataService;
  5. class ParametersGenerator
  6. {
  7.     /** @required */
  8.     public CommonDataService $commonDataService;
  9.     /**
  10.      * @param array $parameters
  11.      * @return array
  12.      * @throws Exception
  13.      */
  14.     public function generate(array $parameters): array
  15.     {
  16.         $parameters['initialState'] = array_merge($parameters['initialState'] ?? [], [
  17.             'common' => [
  18.                 'top' => $this->commonDataService->top(),
  19.                 'footer' => $this->commonDataService->footer(),
  20.                 'constants' => $this->commonDataService->constants(),
  21.                 'userData' => $this->commonDataService->userData(),
  22.                 'urls' => $this->commonDataService->urls(),
  23.                 'trans' => $this->commonDataService->trans(),
  24.                 'commentablePageData' => $this->commonDataService->commentablePageData(),
  25.             ],
  26.         ]);
  27.         return $parameters;
  28.     }
  29. }