ErrorPage.inc 483 B

1234567891011121314151617181920212223242526
  1. <?php
  2. class ErrorPage
  3. {
  4. public static function getInstance()
  5. {
  6. return new ErrorPage(new Header(), new TwigWrapper());
  7. }
  8. private $header;
  9. private $twig;
  10. private function __construct(Header $header, TwigWrapper $twig)
  11. {
  12. $this->header = $header;
  13. $this->twig = $twig;
  14. }
  15. public function process(Exception $e)
  16. {
  17. $this->header->serverError();
  18. $data = array();
  19. $data['errorMessage'] = $e->getMessage();
  20. return $this->twig->render('page_error.html', $data);
  21. }
  22. }