aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2014-09-23 11:08:09 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2014-09-23 11:08:09 +0200
commitfa26e48bad651ac2b1839981e93afbced6f5fe5d (patch)
treef271fcf717721dfa7cf8ee6210451a4b4dbc5b2d
parent90a37a618ee9771a78a2a7a79bcb363a6151a40f (diff)
downloadEventsource-fa26e48bad651ac2b1839981e93afbced6f5fe5d.zip
Eventsource-fa26e48bad651ac2b1839981e93afbced6f5fe5d.tar.gz
Eventsource-fa26e48bad651ac2b1839981e93afbced6f5fe5d.tar.bz2
Remove from/import and update to PHP5.4.
-rw-r--r--Exception.php8
-rw-r--r--Server.php35
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 @@ namespace Hoa\EventSource {
* @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 @@ class Server {
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 @@ class Server {
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 @@ class Server {
*/
public function getLastId ( ) {
- return \Hoa\Http\Runtime::getHeader('Last-Event-ID') ?: '';
+ return Http\Runtime::getHeader('Last-Event-ID') ?: '';
}
}
-
-}