2015-09-17 23:11:18 -04:00
|
|
|
<?php
|
2015-11-16 11:40:01 -05:00
|
|
|
/**
|
|
|
|
* Ion
|
|
|
|
*
|
|
|
|
* Building blocks for web development
|
|
|
|
*
|
|
|
|
* @package Ion
|
|
|
|
* @author Timothy J. Warren
|
|
|
|
* @copyright Copyright (c) 2015
|
|
|
|
* @license MIT
|
|
|
|
*/
|
2015-09-17 23:11:18 -04:00
|
|
|
|
|
|
|
namespace Aviat\Ion\View;
|
|
|
|
|
|
|
|
use Aura\Web\ResponseSender;
|
|
|
|
|
|
|
|
use Aviat\Ion\View as BaseView;
|
|
|
|
|
2015-10-09 22:29:59 -04:00
|
|
|
/**
|
|
|
|
* Base view class for Http output
|
|
|
|
*/
|
2015-09-17 23:11:18 -04:00
|
|
|
class HttpView extends BaseView {
|
2015-10-09 22:29:59 -04:00
|
|
|
|
2015-09-17 23:11:18 -04:00
|
|
|
/**
|
|
|
|
* Do a redirect
|
2015-10-09 22:29:59 -04:00
|
|
|
*
|
2015-09-17 23:11:18 -04:00
|
|
|
* @param string $url
|
|
|
|
* @param int $code
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function redirect($url, $code)
|
|
|
|
{
|
|
|
|
$this->response->redirect->to($url, $code);
|
|
|
|
}
|
2015-10-09 22:29:59 -04:00
|
|
|
|
2015-09-17 23:11:18 -04:00
|
|
|
/**
|
|
|
|
* Send the appropriate response
|
|
|
|
*
|
2015-10-15 09:25:30 -04:00
|
|
|
* @codeCoverageIgnore
|
2015-09-17 23:11:18 -04:00
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected function output()
|
|
|
|
{
|
|
|
|
parent::output();
|
|
|
|
|
|
|
|
$sender = new ResponseSender($this->response);
|
|
|
|
$sender->__invoke();
|
|
|
|
}
|
2015-10-09 22:29:59 -04:00
|
|
|
|
2015-09-17 23:11:18 -04:00
|
|
|
}
|