Skip to content

Instantly share code, notes, and snippets.

@evanpurkhiser
Created October 28, 2012 13:05
Show Gist options
  • Select an option

  • Save evanpurkhiser/3968537 to your computer and use it in GitHub Desktop.

Select an option

Save evanpurkhiser/3968537 to your computer and use it in GitHub Desktop.
<?php
class HTTP_Exception_200 extends HTTP_Exception {
protected $_status = 200;
protected $_response;
/**
* Set the response object to retur when requested from get_response
*
* @param Response $response A Response object
*/
public function set_response(Response $response = NULL)
{
$this->_response = $response;
return $this;
}
/**
* Return the response
*
* @return Response
*/
public function get_response()
{
return $this->_response;
}
}
<?php
class Controller_Derp extends Controller {
public function before()
{
$response = Request::factory('controller/action')->execute();
throw HTTP_Exception::factory(200)->set_response($response);
}
public function after()
{
// Some super duper extra expensive code that I don't want to run or alter my response
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment