-
-
Save graphis/4130064 to your computer and use it in GitHub Desktop.
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 | |
| 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; | |
| } | |
| } |
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 | |
| 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