aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2014-11-13 10:26:17 +0100
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2014-11-13 10:26:17 +0100
commit9cf765fc4bb30105f9d92db8e21b8f511af028a2 (patch)
treecc81ca6017e05af71133ca5254e91f48ce13ed97
parent2a8fe9ec5ff9828ab39209be79305e26bfe338db (diff)
downloadFastcgi-9cf765fc4bb30105f9d92db8e21b8f511af028a2.zip
Fastcgi-9cf765fc4bb30105f9d92db8e21b8f511af028a2.tar.gz
Fastcgi-9cf765fc4bb30105f9d92db8e21b8f511af028a2.tar.bz2
Remove from/import and update to PHP5.4.2.14.11.15
-rw-r--r--Connection.php12
-rw-r--r--Documentation/En/Index.xyl4
-rw-r--r--Documentation/Fr/Index.xyl4
-rw-r--r--Exception/CannotMultiplex.php15
-rw-r--r--Exception/Exception.php14
-rw-r--r--Exception/Overloaded.php15
-rw-r--r--Exception/UnknownRole.php15
-rw-r--r--README.md4
-rw-r--r--Responder.php45
9 files changed, 26 insertions, 102 deletions
diff --git a/Connection.php b/Connection.php
index 28f816f..c20abb4 100644
--- a/Connection.php
+++ b/Connection.php
@@ -34,7 +34,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-namespace Hoa\Fastcgi {
+namespace Hoa\Fastcgi;
/**
* Class \Hoa\Fastcgi\Connection.
@@ -139,7 +139,7 @@ abstract class Connection {
foreach($pairs as $key => $value) {
- foreach(array($key, $value) as $handle) {
+ foreach([$key, $value] as $handle) {
$length = strlen($handle);
@@ -172,7 +172,7 @@ abstract class Connection {
if(null === $length)
$length = strlen($pack);
- $out = array();
+ $out = [];
$i = 0;
for($i = 0; $length >= $i; $i += $keyLength + $valueLength) {
@@ -212,7 +212,7 @@ abstract class Connection {
|| empty($pack))
return false;
- $headers = array(
+ $headers = [
self::HEADER_VERSION => ord($pack[0]),
self::HEADER_TYPE => ord($pack[1]),
self::HEADER_REQUEST_ID => (ord($pack[2]) << 8) +
@@ -222,7 +222,7 @@ abstract class Connection {
self::HEADER_PADDING_LENGTH => ord($pack[6]),
self::HEADER_RESERVED => ord($pack[7]),
self::HEADER_CONTENT => null
- );
+ ];
$length = $headers[self::HEADER_CONTENT_LENGTH] +
$headers[self::HEADER_PADDING_LENGTH];
@@ -247,5 +247,3 @@ abstract class Connection {
*/
abstract protected function read ( $length );
}
-
-}
diff --git a/Documentation/En/Index.xyl b/Documentation/En/Index.xyl
index ce5ac7c..4592251 100644
--- a/Documentation/En/Index.xyl
+++ b/Documentation/En/Index.xyl
@@ -108,11 +108,11 @@
echo 'foobar';</code></pre>
<p>And we add in the <code>Responder.php</code> file:</p>
- <pre><code class="language-php">var_dump($fastcgi->send(array(
+ <pre><code class="language-php">var_dump($fastcgi->send([
'REQUEST_METHOD' => 'GET',
'REQUEST_URI' => '/',
'SCRIPT_FILENAME' => __DIR__ . DS . 'Echo.php'
-)));
+]));
/**
* Will output:
diff --git a/Documentation/Fr/Index.xyl b/Documentation/Fr/Index.xyl
index ee20db4..c0affb0 100644
--- a/Documentation/Fr/Index.xyl
+++ b/Documentation/Fr/Index.xyl
@@ -111,11 +111,11 @@
echo 'foobar';</code></pre>
<p>Et nous ajoutons à <code>Responder.php</code> :</p>
- <pre><code class="language-php">var_dump($fastcgi->send(array(
+ <pre><code class="language-php">var_dump($fastcgi->send([
'REQUEST_METHOD' => 'GET',
'REQUEST_URI' => '/',
'SCRIPT_FILENAME' => __DIR__ . DS . 'Echo.php'
-)));
+]));
/**
* Will output:
diff --git a/Exception/CannotMultiplex.php b/Exception/CannotMultiplex.php
index aaa3694..d255f14 100644
--- a/Exception/CannotMultiplex.php
+++ b/Exception/CannotMultiplex.php
@@ -34,18 +34,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-namespace {
-
-from('Hoa')
-
-/**
- * \Hoa\Fastcgi\Exception
- */
--> import('Fastcgi.Exception.~');
-
-}
-
-namespace Hoa\Fastcgi\Exception {
+namespace Hoa\Fastcgi\Exception;
/**
* Class \Hoa\Fastcgi\Exception\CannotMultiplex.
@@ -61,5 +50,3 @@ namespace Hoa\Fastcgi\Exception {
*/
class CannotMultiplex extends Exception { }
-
-}
diff --git a/Exception/Exception.php b/Exception/Exception.php
index 7054a40..b93679b 100644
--- a/Exception/Exception.php
+++ b/Exception/Exception.php
@@ -34,7 +34,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-namespace Hoa\Fastcgi\Exception {
+namespace Hoa\Fastcgi\Exception;
+
+use Hoa\Core;
/**
* Class \Hoa\Fastcgi\Exception.
@@ -46,15 +48,9 @@ namespace Hoa\Fastcgi\Exception {
* @license New BSD License
*/
-class Exception extends \Hoa\Core\Exception { }
-
-}
-
-namespace {
+class Exception extends Core\Exception { }
/**
* Flex entity.
*/
-Hoa\Core\Consistency::flexEntity('Hoa\Fastcgi\Exception\Exception');
-
-}
+Core\Consistency::flexEntity('Hoa\Fastcgi\Exception\Exception');
diff --git a/Exception/Overloaded.php b/Exception/Overloaded.php
index 5b4a028..13a32f2 100644
--- a/Exception/Overloaded.php
+++ b/Exception/Overloaded.php
@@ -34,18 +34,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-namespace {
-
-from('Hoa')
-
-/**
- * \Hoa\Fastcgi\Exception
- */
--> import('Fastcgi.Exception.~');
-
-}
-
-namespace Hoa\Fastcgi\Exception {
+namespace Hoa\Fastcgi\Exception;
/**
* Class \Hoa\Fastcgi\Exception\Overloaded.
@@ -60,5 +49,3 @@ namespace Hoa\Fastcgi\Exception {
*/
class Overloaded extends Exception { }
-
-}
diff --git a/Exception/UnknownRole.php b/Exception/UnknownRole.php
index ad4a991..7f39785 100644
--- a/Exception/UnknownRole.php
+++ b/Exception/UnknownRole.php
@@ -34,18 +34,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-namespace {
-
-from('Hoa')
-
-/**
- * \Hoa\Fastcgi\Exception
- */
--> import('Fastcgi.Exception.~');
-
-}
-
-namespace Hoa\Fastcgi\Exception {
+namespace Hoa\Fastcgi\Exception;
/**
* Class \Hoa\Fastcgi\Exception\UnknownRole.
@@ -60,5 +49,3 @@ namespace Hoa\Fastcgi\Exception {
*/
class UnknownRole extends Exception { }
-
-}
diff --git a/README.md b/README.md
index 22b3a0b..29b9689 100644
--- a/README.md
+++ b/README.md
@@ -64,11 +64,11 @@ Thus:
$fastcgi = new Hoa\Fastcgi\Responder(
new Hoa\Socket\Client('tcp://127.0.0.1:9000')
);
-var_dump($fastcgi->send(array(
+var_dump($fastcgi->send([
'REQUEST_METHOD' => 'GET',
'REQUEST_URI' => '/',
'SCRIPT_FILENAME' => __DIR__ . DS . 'Echo.php'
-)));
+]));
// string(6) "foobar"
```
diff --git a/Responder.php b/Responder.php
index 1396877..652bb33 100644
--- a/Responder.php
+++ b/Responder.php
@@ -34,38 +34,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-namespace {
+namespace Hoa\Fastcgi;
-from('Hoa')
-
-/**
- * \Hoa\Fastcgi\Exception
- */
--> import('Fastcgi.Exception.~')
-
-/**
- * \Hoa\Fastcgi\Exception\CannotMultiplex
- */
--> import('Fastcgi.Exception.CannotMultiplex')
-
-/**
- * \Hoa\Fastcgi\Exception\Overloaded
- */
--> import('Fastcgi.Exception.Overloaded')
-
-/**
- * \Hoa\Fastcgi\Exception\UnknownRole
- */
--> import('Fastcgi.Exception.UnknownRole')
-
-/**
- * \Hoa\Fastcgi\Connection
- */
--> import('Fastcgi.Connection');
-
-}
-
-namespace Hoa\Fastcgi {
+use Hoa\Socket;
/**
* Class \Hoa\Fastcgi\Responder.
@@ -171,16 +142,16 @@ class Responder extends Connection {
/**
* Response: content.
*
- * @var \Hoa\Fastcgi\Client string
+ * @var \Hoa\Fastcgi\Responder string
*/
protected $_content = null;
/**
* Response: headers.
*
- * @var \Hoa\Fastcgi\Client array
+ * @var \Hoa\Fastcgi\Responder array
*/
- protected $_headers = array();
+ protected $_headers = [];
@@ -191,7 +162,7 @@ class Responder extends Connection {
* @param \Hoa\Socket\Client $client Client connection.
* @return void
*/
- public function __construct ( \Hoa\Socket\Client $client ) {
+ public function __construct ( Socket\Client $client ) {
$this->setClient($client);
@@ -337,7 +308,7 @@ class Responder extends Connection {
* @param \Hoa\Socket\Client $client Client.
* @return \Hoa\Socket\Client
*/
- public function setClient ( \Hoa\Socket\Client $client ) {
+ public function setClient ( Socket\Client $client ) {
$old = $this->_client;
$this->_client = $client;
@@ -356,5 +327,3 @@ class Responder extends Connection {
return $this->_client;
}
}
-
-}