Skip to content

Instantly share code, notes, and snippets.

@sbward
Created March 15, 2013 21:26
Show Gist options
  • Save sbward/5173220 to your computer and use it in GitHub Desktop.
Save sbward/5173220 to your computer and use it in GitHub Desktop.
An error handling controller prototype
<?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;
}
}
@sbward
Copy link
Author

sbward commented Mar 15, 2013

$this->render is defined by TemplateRenderer, which uses configuration and classes pulled from the Factory (haven't decided how to structure that part yet)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment