Permalink
Browse files

CS fixes in accordance with PSR2, except when in conflict with the PE…

…AR CS.
  • Loading branch information...
1 parent 645048f commit 42f964d30a0a911452346c6d813be267341dd345 @boenrobot boenrobot committed Dec 26, 2012
View
@@ -25,4 +25,4 @@
= $phpDir . DIRECTORY_SEPARATOR . $pkg . '.php';
}
}
-chdir($oldCwd);
+chdir($oldCwd);
View
@@ -40,15 +40,18 @@
$package->files['tests/bootstrap.php'] = array_merge_recursive(
- $package->files['tests/bootstrap.php']->getArrayCopy(), $srcDirTask
+ $package->files['tests/bootstrap.php']->getArrayCopy(),
+ $srcDirTask
);
$package->files['docs/phpdoc.dist.xml'] = array_merge_recursive(
- $package->files['docs/phpdoc.dist.xml']->getArrayCopy(), $srcDirTask
+ $package->files['docs/phpdoc.dist.xml']->getArrayCopy(),
+ $srcDirTask
);
$package->files['docs/doxygen.ini'] = array_merge_recursive(
- $package->files['docs/doxygen.ini']->getArrayCopy(), $srcDirTask,
+ $package->files['docs/doxygen.ini']->getArrayCopy(),
+ $srcDirTask,
array(
'tasks:replace' => array(
array(
@@ -70,22 +73,25 @@
] = array_merge_recursive(
$compatible->files[
"test/{$package->channel}/{$package->name}/bootstrap.php"
- ]->getArrayCopy(), $srcDirTask
+ ]->getArrayCopy(),
+ $srcDirTask
);
$compatible->files[
"doc/{$package->channel}/{$package->name}/phpdoc.dist.xml"
] = array_merge_recursive(
$compatible->files[
"doc/{$package->channel}/{$package->name}/phpdoc.dist.xml"
- ]->getArrayCopy(), $srcDirTask
+ ]->getArrayCopy(),
+ $srcDirTask
);
$compatible->files["doc/{$package->channel}/{$package->name}/doxygen.ini"]
= array_merge_recursive(
$compatible->files[
"doc/{$package->channel}/{$package->name}/doxygen.ini"
- ]->getArrayCopy(), $srcDirTask,
+ ]->getArrayCopy(),
+ $srcDirTask,
array(
'tasks:replace' => array(
array(
@@ -113,7 +119,8 @@
$filename = $path->getPathname();
$package->files[$filename] = array_merge_recursive(
- $package->files[$filename]->getArrayCopy(), $srcFileTasks
+ $package->files[$filename]->getArrayCopy(),
+ $srcFileTasks
);
if ($hasCompatible) {
@@ -124,4 +131,4 @@
);
}
}
-chdir($oldCwd);
+chdir($oldCwd);
@@ -31,5 +31,4 @@
*/
interface Exception
{
-
-}
+}
@@ -224,5 +224,4 @@ public function valid()
{
return array_key_exists($this->position, $this->filters);
}
-
-}
+}
@@ -31,5 +31,4 @@
*/
class LockException extends \RuntimeException implements Exception
{
-
-}
+}
@@ -89,4 +89,4 @@ public function shutdown($direction = self::DIRECTION_ALL)
return array_key_exists($direction, $directionMap)
&& stream_socket_shutdown($this->stream, $directionMap[$direction]);
}
-}
+}
@@ -52,8 +52,12 @@ class SocketException extends \RuntimeException implements Exception
* @param int $error_no The system level error number.
* @param string $error_str The system level error message.
*/
- public function __construct($message = '', $code = 0, $previous = null,
- $error_no = null, $error_str = null
+ public function __construct(
+ $message = '',
+ $code = 0,
+ $previous = null,
+ $error_no = null,
+ $error_str = null
) {
parent::__construct($message, $code, $previous);
$this->error_no = $error_no;
@@ -100,6 +104,5 @@ public function __toString()
}
return $result;
}
-
// @codeCoverageIgnoreEnd
-}
+}
@@ -84,7 +84,8 @@ public function __construct($stream)
}
$this->stream = $stream;
$this->persist = (bool) preg_match(
- '#\s?persistent\s?#sm', get_resource_type($stream)
+ '#\s?persistent\s?#sm',
+ get_resource_type($stream)
);
}
@@ -250,13 +251,16 @@ public function send($contents, $offset = null, $length = null)
break;
}
$bytesNow = @stream_copy_to_stream(
- $contents, $this->stream, $chunkSize
+ $contents,
+ $this->stream,
+ $chunkSize
);
if (0 != $bytesNow) {
$bytes += $bytesNow;
} else {
throw $this->createException(
- 'Failed while sending stream.', 2
+ 'Failed while sending stream.',
+ 2
);
}
}
@@ -278,13 +282,15 @@ public function send($contents, $offset = null, $length = null)
while ($bytes < $bytesToSend) {
if ($this->isAcceptingData()) {
$bytesNow = @fwrite(
- $this->stream, substr($contents, $bytes, $chunkSize)
+ $this->stream,
+ substr($contents, $bytes, $chunkSize)
);
if (0 != $bytesNow) {
$bytes += $bytesNow;
} else {
throw $this->createException(
- 'Failed while sending string.', 3
+ 'Failed while sending string.',
+ 3
);
}
}
@@ -320,7 +326,8 @@ public function receive($length, $what = 'data')
}
}
throw $this->createException(
- "Failed while receiving {$what}", 4
+ "Failed while receiving {$what}",
+ 4
);
}
return $result;
@@ -341,14 +348,19 @@ public function receive($length, $what = 'data')
* @return resource The received content.
*/
public function receiveStream(
- $length, FilterCollection $filters = null, $what = 'stream data'
+ $length,
+ FilterCollection $filters = null,
+ $what = 'stream data'
) {
$result = fopen('php://temp', 'r+b');
$appliedFilters = array();
if (null !== $filters) {
foreach ($filters as $filtername => $params) {
$appliedFilters[] = stream_filter_append(
- $result, $filtername, STREAM_FILTER_WRITE, $params
+ $result,
+ $filtername,
+ STREAM_FILTER_WRITE,
+ $params
);
}
}
@@ -366,7 +378,8 @@ public function receiveStream(
}
}
throw $this->createException(
- "Failed while receiving {$what}", 5
+ "Failed while receiving {$what}",
+ 5
);
}
@@ -447,5 +460,4 @@ protected function createException($message, $code = 0)
{
return new StreamException($message, $code);
}
-
-}
+}
@@ -31,5 +31,4 @@
*/
class StreamException extends \RuntimeException implements Exception
{
-
-}
+}
@@ -79,8 +79,13 @@ class TcpClient extends NetworkStream
* connection.
* @param resource $context A context for the socket.
*/
- public function __construct($host, $port, $persist = false,
- $timeout = null, $key = '', $context = null
+ public function __construct(
+ $host,
+ $port,
+ $persist = false,
+ $timeout = null,
+ $key = '',
+ $context = null
) {
if (strpos($host, ':') !== false) {
$host = "[{$host}]";
@@ -107,8 +112,12 @@ public function __construct($host, $port, $persist = false,
try {
parent::__construct(
@stream_socket_client(
- $this->uri, $this->error_no, $this->error_str,
- $timeout, $flags, $context
+ $this->uri,
+ $this->error_no,
+ $this->error_str,
+ $timeout,
+ $flags,
+ $context
)
);
} catch (\Exception $e) {
@@ -138,7 +147,11 @@ public function __construct($host, $port, $persist = false,
protected function createException($message, $code = 0)
{
return new SocketException(
- $message, $code, null, $this->error_no, $this->error_str
+ $message,
+ $code,
+ null,
+ $this->error_no,
+ $this->error_str
);
}
@@ -210,7 +223,7 @@ public function lock($direction = self::DIRECTION_ALL, $replace = false)
);
}
}
- } catch(LockException $e) {
+ } catch (LockException $e) {
if ($direction & self::DIRECTION_SEND
&& !($old & self::DIRECTION_SEND)
) {
@@ -246,7 +259,8 @@ public function send($contents, $offset = null, $length = null)
&& $this->persist
) {
throw $this->createException(
- 'Unable to obtain sending lock', 10
+ 'Unable to obtain sending lock',
+ 10
);
}
$result = parent::send($contents, $offset, $length);
@@ -271,7 +285,8 @@ public function receive($length, $what = 'data')
&& $this->persist
) {
throw $this->createException(
- 'Unable to obtain receiving lock', 9
+ 'Unable to obtain receiving lock',
+ 9
);
}
$result = parent::receive($length, $what);
@@ -294,17 +309,20 @@ public function receive($length, $what = 'data')
* @return resource The received content.
*/
public function receiveStream(
- $length, FilterCollection $filters = null, $what = 'stream data'
+ $length,
+ FilterCollection $filters = null,
+ $what = 'stream data'
) {
if (false === ($previousState = $this->lock(self::DIRECTION_RECEIVE))
&& $this->persist
) {
throw $this->createException(
- 'Unable to obtain receiving lock', 9
+ 'Unable to obtain receiving lock',
+ 9
);
}
$result = parent::receiveStream($length, $filters, $what);
$this->lock($previousState, true);
return $result;
}
-}
+}
@@ -69,7 +69,9 @@ public function __construct($server, $timeout = null)
$portString = strrchr($peername, ':');
$this->peerPort = (int) substr($portString, 1);
$ipString = substr(
- $peername, 0, strlen($peername) - strlen($portString)
+ $peername,
+ 0,
+ strlen($peername) - strlen($portString)
);
if (strpos($ipString, '[') === 0
&& strpos(strrev($ipString), ']') === 0
@@ -79,7 +81,8 @@ public function __construct($server, $timeout = null)
$this->peerIP = $ipString;
} catch (Exception $e) {
throw $this->createException(
- 'Failed to initialize connection.', 10
+ 'Failed to initialize connection.',
+ 10
);
}
}
@@ -118,5 +121,4 @@ protected function createException($message, $code = 0)
{
return new SocketException($message, $code);
}
-
-}
+}
Oops, something went wrong.

0 comments on commit 42f964d

Please sign in to comment.