Created
March 15, 2013 21:26
-
-
Save sbward/5173220 to your computer and use it in GitHub Desktop.
An error handling controller prototype
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace MyApplication\Controller; | |
use Hydrogen\Controller; | |
use Hydrogen\TemplateRenderer; | |
class Error extends Controller | |
{ | |
use TemplateRenderer; | |
public function error($message = "Server Error", $httpCode = 500) | |
{ | |
if(PHP_CLI) | |
{ | |
$this->render('error.cli.mustache', compact($message)); | |
} | |
else | |
{ | |
$this->render('error.phtml', compact($message, $httpCode)); | |
} | |
return $this->response; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$this->render is defined by TemplateRenderer, which uses configuration and classes pulled from the Factory (haven't decided how to structure that part yet)