Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Commit

Permalink
Merge branch 'from_import' into incoming
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed Oct 5, 2014
2 parents 3ab5c44 + fa26e48 commit 454b4f9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 32 deletions.
8 changes: 4 additions & 4 deletions Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/

namespace Hoa\EventSource {
namespace Hoa\EventSource;

use Hoa\Core;

/**
* Class \Hoa\EventSource\Exception.
Expand All @@ -46,6 +48,4 @@
* @license New BSD License
*/

class Exception extends \Hoa\Core\Exception { }

}
class Exception extends Core\Exception { }
35 changes: 7 additions & 28 deletions Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand All @@ -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',
Expand Down Expand Up @@ -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') ?: '';
}
}

}

0 comments on commit 454b4f9

Please sign in to comment.