<?php
class ErrorPage
{

	public static function getInstance()
	{
		return new ErrorPage(new Header(), new TwigWrapper());
	}
	private $header;
	private $twig;

	private function __construct(Header $header, TwigWrapper $twig)
	{
		$this->header = $header;
		$this->twig = $twig;
	}

	public function process(Exception $e)
	{
		$this->header->serverError();
		
		$data = array();
		$data['errorMessage'] = $e->getMessage();
		return $this->twig->render('page_error.html', $data);
	}
}