Completed
Pull Request — master (#126)
by Maxime
04:34
created
src/Client/Connection.php 2 patches
Unused Use Statements   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -12,18 +12,18 @@
 block discarded – undo
12 12
 namespace Nekland\Woketo\Client;
13 13
 
14 14
 
15
-use Nekland\Woketo\Core\AbstractConnection;
16
-use Nekland\Woketo\Exception\Http\IncompleteHttpMessageException;
17
-use Nekland\Woketo\Exception\RuntimeException;
18
-use Nekland\Woketo\Exception\WebsocketException;
19
-use Nekland\Woketo\Http\Response;
20
-use Nekland\Woketo\Http\Url;
21
-use Nekland\Woketo\Message\MessageHandlerInterface;
22
-use Nekland\Woketo\Rfc6455\Frame;
23
-use Nekland\Woketo\Rfc6455\Handshake\ClientHandshake;
24
-use Nekland\Woketo\Rfc6455\MessageProcessor;
25
-use React\EventLoop\LoopInterface;
26
-use React\Promise\PromiseInterface;
15
+use Nekland\Woketo\Core\AbstractConnection;
16
+use Nekland\Woketo\Exception\Http\IncompleteHttpMessageException;
17
+use Nekland\Woketo\Exception\RuntimeException;
18
+use Nekland\Woketo\Exception\WebsocketException;
19
+use Nekland\Woketo\Http\Response;
20
+use Nekland\Woketo\Http\Url;
21
+use Nekland\Woketo\Message\MessageHandlerInterface;
22
+use Nekland\Woketo\Rfc6455\Frame;
23
+use Nekland\Woketo\Rfc6455\Handshake\ClientHandshake;
24
+use Nekland\Woketo\Rfc6455\MessageProcessor;
25
+use React\EventLoop\LoopInterface;
26
+use React\Promise\PromiseInterface;
27 27
 use React\Socket\ConnectionInterface;
28 28
 
29 29
 class Connection extends AbstractConnection
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -52,17 +52,17 @@  discard block
 block discarded – undo
52 52
         $this->buffer = '';
53 53
         $this->handler = $handler;
54 54
 
55
-        $clientPromise->then(function (ConnectionInterface $stream) {
55
+        $clientPromise->then(function(ConnectionInterface $stream) {
56 56
             $this->stream = $stream;
57 57
             $this->onConnection($stream);
58
-        }, function (\Exception $error) {
58
+        }, function(\Exception $error) {
59 59
             $this->onError($error);
60 60
         });
61 61
     }
62 62
 
63 63
     private function onConnection(ConnectionInterface $stream)
64 64
     {
65
-        $stream->on('data', function (string $data) {
65
+        $stream->on('data', function(string $data) {
66 66
             $this->onMessage($data);
67 67
         });
68 68
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
             if ($this->currentMessage->isComplete()) {
125 125
                 // Sending the message through the woketo API.
126
-                switch($this->currentMessage->getOpcode()) {
126
+                switch ($this->currentMessage->getOpcode()) {
127 127
                     case Frame::OP_TEXT:
128 128
                         $this->getHandler()->onMessage($this->currentMessage->getContent(), $this);
129 129
                         break;
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 
136 136
             } else {
137 137
                 // We wait for more data so we start a timeout.
138
-                $this->timeout = $this->loop->addTimer(Connection::DEFAULT_TIMEOUT, function () {
138
+                $this->timeout = $this->loop->addTimer(Connection::DEFAULT_TIMEOUT, function() {
139 139
                     $this->getLogger()->notice('Connection to ' . $this->getIp() . ' timed out.');
140 140
                     $this->messageProcessor->timeout($this->stream);
141 141
                 });
Please login to merge, or discard this patch.
src/Core/AbstractConnection.php 1 patch
Unused Use Statements   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -11,19 +11,19 @@
 block discarded – undo
11 11
 
12 12
 namespace Nekland\Woketo\Core;
13 13
 
14
-use Nekland\Woketo\Exception\NoHandlerException;
15
-use Nekland\Woketo\Exception\WebsocketException;
16
-use Nekland\Woketo\Message\MessageHandlerInterface;
17
-use Nekland\Woketo\Rfc6455\Frame;
18
-use Nekland\Woketo\Rfc6455\Handshake\HandshakeInterface;
19
-use Nekland\Woketo\Rfc6455\Message;
20
-use Nekland\Woketo\Rfc6455\MessageProcessor;
21
-use Nekland\Woketo\Utils\SimpleLogger;
22
-use Psr\Log\LoggerAwareTrait;
23
-use Psr\Log\LoggerInterface;
24
-use React\EventLoop\LoopInterface;
25
-use React\EventLoop\Timer\TimerInterface;
26
-use React\Socket\Connection;
14
+use Nekland\Woketo\Exception\NoHandlerException;
15
+use Nekland\Woketo\Exception\WebsocketException;
16
+use Nekland\Woketo\Message\MessageHandlerInterface;
17
+use Nekland\Woketo\Rfc6455\Frame;
18
+use Nekland\Woketo\Rfc6455\Handshake\HandshakeInterface;
19
+use Nekland\Woketo\Rfc6455\Message;
20
+use Nekland\Woketo\Rfc6455\MessageProcessor;
21
+use Nekland\Woketo\Utils\SimpleLogger;
22
+use Psr\Log\LoggerAwareTrait;
23
+use Psr\Log\LoggerInterface;
24
+use React\EventLoop\LoopInterface;
25
+use React\EventLoop\Timer\TimerInterface;
26
+use React\Socket\Connection;
27 27
 use React\Socket\ConnectionInterface;
28 28
 
29 29
 abstract class AbstractConnection
Please login to merge, or discard this patch.