Completed
Push — master ( 0b3013...288985 )
by Ryosuke
04:35 queued 01:25
created
examples/localhost/server.php 2 patches
Doc Comments   +9 added lines patch added patch discarded remove patch
@@ -12,6 +12,10 @@  discard block
 block discarded – undo
12 12
         throw new \RuntimeException($error['message']);
13 13
     }
14 14
 }
15
+/**
16
+ * @param integer $status
17
+ * @param string $message
18
+ */
15 19
 function respond_rest($con, $status, $message, $content) {
16 20
     try {
17 21
         $length = strlen($content);
@@ -24,6 +28,11 @@  discard block
 block discarded – undo
24 28
     }
25 29
     fclose($con);
26 30
 }
31
+/**
32
+ * @param Closure $tick_function
33
+ * @param integer $tick
34
+ * @param integer $times
35
+ */
27 36
 function respond_streaming($con, $tick_function, $tick, $times) {
28 37
     try {
29 38
         fsend($con, "HTTP/1.1 200 OK\r\n");
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -55,8 +55,9 @@  discard block
 block discarded – undo
55 55
         $con = @stream_socket_accept($socket, -1);
56 56
         if (!$con) {
57 57
             $err = error_get_last(); // どーなんだこれ strerror(EINTR)
58
-            if (strpos($err["message"], "Interrupted system call") !== false)
59
-                continue;
58
+            if (strpos($err["message"], "Interrupted system call") !== false) {
59
+                            continue;
60
+            }
60 61
             fwrite(STDERR, "[Server] " . $err["message"] . "\n");
61 62
             exit(1);
62 63
         }
@@ -91,7 +92,9 @@  discard block
 block discarded – undo
91 92
         parse_str(isset($parsed['query']) ? $parsed['query'] : '', $q);
92 93
         foreach ($endpoints as $endpoint => $action) {
93 94
             if ($parsed['path'] === $endpoint || $endpoint === '') {
94
-                if ($endpoint === '') $endpoint = '[Undefined]';
95
+                if ($endpoint === '') {
96
+                    $endpoint = '[Undefined]';
97
+                }
95 98
                 fwrite(STDERR, "Request: $parts[1]\n");
96 99
                 $action($con, $q);
97 100
                 exit(0);
Please login to merge, or discard this patch.
src/Co.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -323,8 +323,10 @@
 block discarded – undo
323 323
             // NOTE: DO NOT call curl_multi_remove_handle
324 324
             //       or curl_multi_add_handle while looping curl_multi_info_read!
325 325
             $entries = array();
326
-            do if ($entry = curl_multi_info_read($this->mh, $remains)) {
326
+            do {
327
+                if ($entry = curl_multi_info_read($this->mh, $remains)) {
327 328
                 $entries[] = $entry;
329
+            }
328 330
             } while ($remains);
329 331
             // Remove done and consume queue.
330 332
             foreach ($entries as $entry) {
Please login to merge, or discard this patch.