Completed
Pull Request — master (#31)
by Hiraku
02:06
created
src/ParallelDownloader.php 1 patch
Switch Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -122,41 +122,41 @@
 block discarded – undo
122 122
                 } while ($stat === CURLM_CALL_MULTI_PERFORM);
123 123
 
124 124
                 switch (curl_multi_select($mh, 5)) {
125
-                case -1:
126
-                    usleep(250);
127
-                    // fall through
128
-                case 0:
129
-                    continue 2;
130
-                default:
131
-                    do {
132
-                        $stat = curl_multi_exec($mh, $running);
133
-                    } while ($stat === CURLM_CALL_MULTI_PERFORM);
134
-
135
-                    do {
136
-                        if ($raised = curl_multi_info_read($mh, $remains)) {
137
-                            $ch = $raised['handle'];
138
-                            $errno = curl_errno($ch);
139
-                            $info = curl_getinfo($ch);
140
-                            curl_setopt($ch, CURLOPT_FILE, STDOUT);
141
-                            $index = (int)$ch;
142
-                            $outputFile = $chFpMap[$index];
143
-                            unset($chFpMap[$index]);
144
-                            if (CURLE_OK === $errno && 200 === $info['http_code']) {
145
-                                ++$this->successCnt;
146
-                            } else {
147
-                                ++$this->failureCnt;
148
-                                $outputFile->setFailure();
125
+                    case -1:
126
+                        usleep(250);
127
+                        // fall through
128
+                    case 0:
129
+                        continue 2;
130
+                    default:
131
+                        do {
132
+                            $stat = curl_multi_exec($mh, $running);
133
+                        } while ($stat === CURLM_CALL_MULTI_PERFORM);
134
+
135
+                        do {
136
+                            if ($raised = curl_multi_info_read($mh, $remains)) {
137
+                                $ch = $raised['handle'];
138
+                                $errno = curl_errno($ch);
139
+                                $info = curl_getinfo($ch);
140
+                                curl_setopt($ch, CURLOPT_FILE, STDOUT);
141
+                                $index = (int)$ch;
142
+                                $outputFile = $chFpMap[$index];
143
+                                unset($chFpMap[$index]);
144
+                                if (CURLE_OK === $errno && 200 === $info['http_code']) {
145
+                                    ++$this->successCnt;
146
+                                } else {
147
+                                    ++$this->failureCnt;
148
+                                    $outputFile->setFailure();
149
+                                }
150
+                                unset($outputFile);
151
+                                $this->io->write($this->makeDownloadingText($info['url']));
152
+                                curl_multi_remove_handle($mh, $ch);
153
+                                $unused[] = $ch;
149 154
                             }
150
-                            unset($outputFile);
151
-                            $this->io->write($this->makeDownloadingText($info['url']));
152
-                            curl_multi_remove_handle($mh, $ch);
153
-                            $unused[] = $ch;
154
-                        }
155
-                    } while ($remains > 0);
155
+                        } while ($remains > 0);
156 156
 
157
-                    if (count($packages) > 0) {
158
-                        break 2;
159
-                    }
157
+                        if (count($packages) > 0) {
158
+                            break 2;
159
+                        }
160 160
                 }
161 161
             } while ($running);
162 162
         } while (count($packages) > 0);
Please login to merge, or discard this patch.