/** * Creates a response with a header to redirect * * @param string * @param int * @return object */ public static function redirect($uri, $status = 302) { // Scrub all output buffer before we redirect. // @see http://www.mombu.com/php/php/t-output-buffering-and-zlib-compression-issue-3554315-last.html while (ob_get_level() > 1) { ob_end_clean(); } return static::create('', $status, array('Location' => Uri::to($uri))); }