Esempio n. 1
0
 /**
  * Returns response for rendered error page.
  *
  * @param  \Exception $exception
  * @param  int        $statusCode
  *
  * @return Response
  */
 private function getErrorPageResponse(\Exception $exception, $statusCode)
 {
     $parameter = $this->application->getContainer()->getParameter('error.default');
     if ($this->application->getContainer()->hasParameter('error.' . $statusCode)) {
         $parameter = $this->application->getContainer()->getParameter('error.' . $statusCode);
     }
     $view = $this->getErrorTemplate($parameter);
     return new Response($this->renderer->partial($view, ['error' => $exception]), $statusCode);
 }
Esempio n. 2
0
 /**
  * Set parameters to a renderer object in parameter.
  *
  * @param AbstractRenderer $render
  * @param array     $params
  */
 private function setRenderParams(AbstractRenderer $render, $params)
 {
     if (null !== $params) {
         $params = (array) $params;
         foreach ($params as $param => $value) {
             $render->setParam($param, $value);
         }
     }
 }