From fa26e48bad651ac2b1839981e93afbced6f5fe5d Mon Sep 17 00:00:00 2001 From: Ivan Enderlin Date: Tue, 23 Sep 2014 11:08:09 +0200 Subject: [PATCH] Remove from/import and update to PHP5.4. --- Exception.php | 8 ++++---- Server.php | 35 +++++++---------------------------- 2 files changed, 11 insertions(+), 32 deletions(-) diff --git a/Exception.php b/Exception.php index a167ed4..3f54789 100644 --- a/Exception.php +++ b/Exception.php @@ -34,7 +34,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ -namespace Hoa\EventSource { +namespace Hoa\EventSource; + +use Hoa\Core; /** * Class \Hoa\EventSource\Exception. @@ -46,6 +48,4 @@ * @license New BSD License */ -class Exception extends \Hoa\Core\Exception { } - -} +class Exception extends Core\Exception { } diff --git a/Server.php b/Server.php index f8b6547..6b0e226 100644 --- a/Server.php +++ b/Server.php @@ -34,28 +34,9 @@ * POSSIBILITY OF SUCH DAMAGE. */ -namespace { +namespace Hoa\Eventsource; -from('Hoa') - -/** - * \Hoa\Eventsource\Exception - */ --> import('Eventsource.Exception') - -/** - * \Hoa\Http\Runtime - */ --> import('Http.Runtime') - -/** - * \Hoa\Http\Response - */ --> import('Http.Response.~'); - -} - -namespace Hoa\Eventsource { +use Hoa\Http; /** * Class \Hoa\Eventsource\Server. @@ -106,9 +87,9 @@ public function __construct ( $verifyHeaders = true ) { throw new Exception( 'Headers already sent in %s at line %d, cannot send data ' . 'to client correctly.', - 0, array($file, $line)); + 0, [$file, $line]); - $mimes = preg_split('#\s*,\s*#', \Hoa\Http\Runtime::getHeader('accept')); + $mimes = preg_split('#\s*,\s*#', Http\Runtime::getHeader('accept')); $gotcha = false; foreach($mimes as $mime) @@ -118,13 +99,13 @@ public function __construct ( $verifyHeaders = true ) { break; } - $this->_response = new \Hoa\Http\Response(false); + $this->_response = new Http\Response(false); if(false === $gotcha) { $this->_response->sendHeader( 'Status', - \Hoa\Http\Response::STATUS_NOT_ACCEPTABLE + Http\Response::STATUS_NOT_ACCEPTABLE ); $this->_response->sendHeader( 'Content-Type', @@ -224,8 +205,6 @@ public function __get ( $event ) { */ public function getLastId ( ) { - return \Hoa\Http\Runtime::getHeader('Last-Event-ID') ?: ''; + return Http\Runtime::getHeader('Last-Event-ID') ?: ''; } } - -}