Completed
Pull Request — master (#29)
by Hiraku
02:13
created
src/Aspects/HttpGetRequest.php 1 patch
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -60,6 +60,9 @@  discard block
 block discarded – undo
60 60
         }
61 61
     }
62 62
 
63
+    /**
64
+     * @param string $url
65
+     */
63 66
     public function importURL($url)
64 67
     {
65 68
         $struct = parse_url($url);
@@ -78,6 +81,11 @@  discard block
 block discarded – undo
78 81
     }
79 82
 
80 83
     // utility for __construct
84
+
85
+    /**
86
+     * @param string $key
87
+     * @param string $default
88
+     */
81 89
     private static function setOr(array $struct, $key, $default=null)
82 90
     {
83 91
         if (!empty($struct[$key])) {
Please login to merge, or discard this patch.
src/ParallelDownloader.php 1 patch
Switch Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -121,44 +121,44 @@
 block discarded – undo
121 121
             // wait for any event
122 122
             do {
123 123
                 switch (curl_multi_select($mh, 5)) {
124
-                case -1:
125
-                    usleep(10);
126
-                    do {
127
-                        $stat = curl_multi_exec($mh, $running);
128
-                    } while ($stat === CURLM_CALL_MULTI_PERFORM);
129
-                    continue 2;
130
-                case 0:
131
-                    continue 2;
132
-                default:
133
-                    do {
134
-                        $stat = curl_multi_exec($mh, $running);
135
-                    } while ($stat === CURLM_CALL_MULTI_PERFORM);
136
-
137
-                    do {
138
-                        if ($raised = curl_multi_info_read($mh, $remains)) {
139
-                            $ch = $raised['handle'];
140
-                            $errno = curl_errno($ch);
141
-                            $info = curl_getinfo($ch);
142
-                            curl_setopt($ch, CURLOPT_FILE, STDOUT);
143
-                            $index = (int)$ch;
144
-                            $outputFile = $chFpMap[$index];
145
-                            unset($chFpMap[$index]);
146
-                            if (CURLE_OK === $errno && 200 === $info['http_code']) {
147
-                                ++$this->successCnt;
148
-                            } else {
149
-                                ++$this->failureCnt;
150
-                                $outputFile->setFailure();
124
+                    case -1:
125
+                        usleep(10);
126
+                        do {
127
+                            $stat = curl_multi_exec($mh, $running);
128
+                        } while ($stat === CURLM_CALL_MULTI_PERFORM);
129
+                        continue 2;
130
+                    case 0:
131
+                        continue 2;
132
+                    default:
133
+                        do {
134
+                            $stat = curl_multi_exec($mh, $running);
135
+                        } while ($stat === CURLM_CALL_MULTI_PERFORM);
136
+
137
+                        do {
138
+                            if ($raised = curl_multi_info_read($mh, $remains)) {
139
+                                $ch = $raised['handle'];
140
+                                $errno = curl_errno($ch);
141
+                                $info = curl_getinfo($ch);
142
+                                curl_setopt($ch, CURLOPT_FILE, STDOUT);
143
+                                $index = (int)$ch;
144
+                                $outputFile = $chFpMap[$index];
145
+                                unset($chFpMap[$index]);
146
+                                if (CURLE_OK === $errno && 200 === $info['http_code']) {
147
+                                    ++$this->successCnt;
148
+                                } else {
149
+                                    ++$this->failureCnt;
150
+                                    $outputFile->setFailure();
151
+                                }
152
+                                unset($outputFile);
153
+                                $this->io->write($this->makeDownloadingText($info['url']));
154
+                                curl_multi_remove_handle($mh, $ch);
155
+                                $unused[] = $ch;
151 156
                             }
152
-                            unset($outputFile);
153
-                            $this->io->write($this->makeDownloadingText($info['url']));
154
-                            curl_multi_remove_handle($mh, $ch);
155
-                            $unused[] = $ch;
156
-                        }
157
-                    } while ($remains);
157
+                        } while ($remains);
158 158
 
159
-                    if ($packages) {
160
-                        break 2;
161
-                    }
159
+                        if ($packages) {
160
+                            break 2;
161
+                        }
162 162
                 }
163 163
             } while ($running);
164 164
         } while ($packages);
Please login to merge, or discard this patch.
src/CurlRemoteFilesystem.php 1 patch
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -108,6 +108,12 @@
 block discarded – undo
108 108
         });
109 109
     }
110 110
 
111
+    /**
112
+     * @param string $origin
113
+     * @param string $fileUrl
114
+     * @param boolean $progress
115
+     * @param \Closure $exec
116
+     */
111 117
     protected function fetch($origin, $fileUrl, $progress, $options, $exec)
112 118
     {
113 119
         do {
Please login to merge, or discard this patch.