twig = $twig; $this->offerRetriever = $offerRetriever; } public function display() { $offerId = $_GET['id']; $page = isset($_GET['page']) ? $_GET['page'] : 0; $templateName = 'templateDoesNotExist.html'; $pageData = array(); if(isset($offerId)) { $pageData = $this->offerRetriever->getPageData($offerId, $page); $templateName = $pageData['filename']; } return $this->twig->render($templateName, $pageData); } }