Guest User

Untitled

a guest
Jul 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. <?php
  2. class ErrorController extends Controller implements IErrorController
  3. {
  4. /** @var boolean */
  5. public $isProduction = false;
  6.  
  7. /** @var array */
  8. private static $codes = array(
  9. 404 => "Stránka nebyla nalezena",
  10. 500 => "Na straně serveru se vyskytla chyba",
  11. );
  12.  
  13. public function process(Exception $exception)
  14. {
  15. if ($this->isProduction)
  16. {
  17. $template = new Template("error.phtml");
  18. $template->code = $exception->getCode();
  19. $template->text = self::$codes[$exception->getCode()];
  20. $this->layout->obsah = $template;
  21. }
  22. else
  23. {
  24. $template = new Template("error.phtml");
  25. $template->text = $exception->getMessage();
  26. $this->layout->obsah = $template;
  27. }
  28. }
  29. }
Add Comment
Please, Sign In to add comment