Completed
Pull Request — master (#100)
by Maxime
02:23
created
src/Server/Connection.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 
70 70
     private function initListeners()
71 71
     {
72
-        $this->stream->on('data', function ($data) {
72
+        $this->stream->on('data', function($data) {
73 73
             $this->processData($data);
74 74
         });
75
-        $this->stream->on('error', function ($data) {
75
+        $this->stream->on('error', function($data) {
76 76
             $this->error($data);
77 77
         });
78 78
     }
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             $this->currentMessage = $message;
115 115
             if ($this->currentMessage->isComplete()) {
116 116
                 // Sending the message through the woketo API.
117
-                switch($this->currentMessage->getOpcode()) {
117
+                switch ($this->currentMessage->getOpcode()) {
118 118
                     case Frame::OP_TEXT:
119 119
                         $this->getHandler()->onMessage($this->currentMessage->getContent(), $this);
120 120
                         break;
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
             } else {
128 128
                 // We wait for more data so we start a timeout.
129
-                $this->timeout = $this->loop->addTimer(Connection::DEFAULT_TIMEOUT, function () {
129
+                $this->timeout = $this->loop->addTimer(Connection::DEFAULT_TIMEOUT, function() {
130 130
                     $this->logger->notice('Connection to ' . $this->getIp() . ' timed out.');
131 131
                     $this->messageProcessor->timeout($this->stream);
132 132
                 });
Please login to merge, or discard this patch.
src/Rfc6455/Handshake/ClientHandshake.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 
30 30
         $key = '';
31 31
         for ($i = 0; $i < 16; $i++) {
32
-            $key .= chr(mt_rand(0,255));
32
+            $key .= chr(mt_rand(0, 255));
33 33
         }
34 34
 
35 35
         $key = base64_encode($key);
Please login to merge, or discard this patch.
src/Http/Response.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         $stringResponse = $this->getHttpVersion() . ' ' . $this->httpResponse . "\r\n";
100 100
 
101 101
         foreach ($this->getHeaders() as $name => $content) {
102
-            $stringResponse .= $name . ': '. $content . "\r\n";
102
+            $stringResponse .= $name . ': ' . $content . "\r\n";
103 103
         }
104 104
 
105 105
         // No content to concatenate
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
      * @return Response
125 125
      * @throws HttpException
126 126
      */
127
-    public static function create(string &$data) : Response
127
+    public static function create(string & $data) : Response
128 128
     {
129 129
         if (!\preg_match('/\\r\\n\\r\\n/', $data)) {
130 130
             throw new IncompleteHttpMessageException();
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     {
163 163
         $httpElements = \explode(' ', $firstLine);
164 164
 
165
-        if (!\preg_match('/HTTP\/[1-2\.]+/',$httpElements[0])) {
165
+        if (!\preg_match('/HTTP\/[1-2\.]+/', $httpElements[0])) {
166 166
             throw Response::createNotHttpException($firstLine);
167 167
         }
168 168
         $response->setHttpVersion($httpElements[0]);
Please login to merge, or discard this patch.
src/Client/Connection.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -52,10 +52,10 @@  discard block
 block discarded – undo
52 52
         $this->host = $host;
53 53
         $this->buffer = '';
54 54
 
55
-        $clientPromise->then(function (Stream $stream) {
55
+        $clientPromise->then(function(Stream $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
         $this->processHandshake('');
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
     private function onConnection(Stream $stream)
65 65
     {
66
-        $stream->on('message', function (string $data) {
66
+        $stream->on('message', function(string $data) {
67 67
             $this->onMessage($data);
68 68
         });
69 69
     }
Please login to merge, or discard this patch.