Completed
Push — master ( 2cecc7...7c9e4e )
by Arthur
04:46
created
src/Components/WscMain.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
         return 'GET ' . $pathWithQuery . " HTTP/1.1\r\n"
160 160
             . implode(
161 161
                 "\r\n", array_map(
162
-                    function ($key, $value) {
162
+                    function($key, $value) {
163 163
                         return "$key: $value";
164 164
                     }, array_keys($headers), $headers
165 165
                 )
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         // Binary string for header.
261 261
         $frameHeadBin = '';
262 262
         // Write FIN, final fragment bit.
263
-        $frameHeadBin .= (bool)$final ? '1' : '0';
263
+        $frameHeadBin .= (bool) $final ? '1' : '0';
264 264
         // RSV 1, 2, & 3 false and unused.
265 265
         $frameHeadBin .= '000';
266 266
         // Opcode rest of the byte.
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 
331 331
         // Is this the final fragment?  // Bit 0 in byte 0
332 332
         /// @todo Handle huge payloads with multiple fragments.
333
-        $final = (bool)(ord($data[0]) & 1 << 7);
333
+        $final = (bool) (ord($data[0]) & 1 << 7);
334 334
 
335 335
         // Parse opcode
336 336
         $opcode_int = ord($data[0]) & 31; // Bits 4-7
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
     private function getPayloadData(string $data, int $payloadLength)
391 391
     {
392 392
         // Masking?
393
-        $mask = (bool)(ord($data[1]) >> 7);  // Bit 0 in byte 1
393
+        $mask = (bool) (ord($data[1]) >> 7); // Bit 0 in byte 1
394 394
         $payload = '';
395 395
         $maskingKey = '';
396 396
         // Get masking key.
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
      */
421 421
     private function getPayloadLength(string $data)
422 422
     {
423
-        $payloadLength = (int)ord($data[1]) & self::MASK_127; // Bits 1-7 in byte 1
423
+        $payloadLength = (int) ord($data[1]) & self::MASK_127; // Bits 1-7 in byte 1
424 424
         if ($payloadLength > self::MASK_125) {
425 425
             if ($payloadLength === self::MASK_126) {
426 426
                 $data = $this->read(2); // 126: Payload is a 16-bit unsigned int
Please login to merge, or discard this patch.
Doc Comments   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     }
138 138
 
139 139
     /**
140
-     * @return mixed|resource
140
+     * @return resource|null
141 141
      * @throws \InvalidArgumentException
142 142
      */
143 143
     private function getStreamContext()
@@ -257,6 +257,9 @@  discard block
 block discarded – undo
257 257
         return $this;
258 258
     }
259 259
 
260
+    /**
261
+     * @param string $payload
262
+     */
260 263
     public function send($payload, $opcode = CommonsContract::EVENT_TYPE_TEXT)
261 264
     {
262 265
         if (!$this->isConnected) {
@@ -289,10 +292,10 @@  discard block
 block discarded – undo
289 292
     }
290 293
 
291 294
     /**
292
-     * @param $final
293
-     * @param $payload
295
+     * @param boolean $final
296
+     * @param string $payload
294 297
      * @param $opcode
295
-     * @param $masked
298
+     * @param boolean $masked
296 299
      * @throws ConnectionException
297 300
      * @throws \Exception
298 301
      */
Please login to merge, or discard this patch.