Completed
Push — master ( e84ecd...b63790 )
by Hiraku
04:17
created
src/CurlRemoteFilesystem.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
      *
57 57
      * @return bool true
58 58
      */
59
-    public function copy($origin, $fileUrl, $fileName, $progress=true, $options=array())
59
+    public function copy($origin, $fileUrl, $fileName, $progress = true, $options = array())
60 60
     {
61
-        return $this->fetch($origin, $fileUrl, $progress, $options, function ($ch, $request) use ($fileName) {
61
+        return $this->fetch($origin, $fileUrl, $progress, $options, function($ch, $request) use ($fileName) {
62 62
             $fp = $this->createFile($fileName);
63 63
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
64 64
             curl_setopt($ch, CURLOPT_FILE, $fp);
@@ -86,9 +86,9 @@  discard block
 block discarded – undo
86 86
      *
87 87
      * @return bool|string The content
88 88
      */
89
-    public function getContents($origin, $fileUrl, $progress=true, $options=array())
89
+    public function getContents($origin, $fileUrl, $progress = true, $options = array())
90 90
     {
91
-        return $this->fetch($origin, $fileUrl, $progress, $options, function ($ch, $request) {
91
+        return $this->fetch($origin, $fileUrl, $progress, $options, function($ch, $request) {
92 92
             // This order is important.
93 93
             curl_setopt($ch, CURLOPT_FILE, STDOUT);
94 94
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
Please login to merge, or discard this patch.
src/Aspects/HttpGetRequest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public function importURL($url)
64 64
     {
65 65
         $struct = parse_url($url);
66
-        if (! $struct) {
66
+        if (!$struct) {
67 67
             throw new \InvalidArgumentException("$url is not valid URL");
68 68
         }
69 69
 
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
         $this->username = self::setOr($struct, 'user', null);
75 75
         $this->password = self::setOr($struct, 'pass', null);
76 76
 
77
-        if (! empty($struct['query'])) {
77
+        if (!empty($struct['query'])) {
78 78
             parse_str($struct['query'], $this->query);
79 79
         }
80 80
     }
81 81
 
82 82
     // utility for __construct
83
-    private static function setOr(array $struct, $key, $default=null)
83
+    private static function setOr(array $struct, $key, $default = null)
84 84
     {
85 85
         if (!empty($struct[$key])) {
86 86
             return $struct[$key];
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
             CURLOPT_USERAGENT => $this->genUA(),
101 101
         );
102 102
 
103
-        $curlOpts[CURLOPT_VERBOSE] = (bool) $this->verbose;
103
+        $curlOpts[CURLOPT_VERBOSE] = (bool)$this->verbose;
104 104
 
105 105
         if ($this->username && $this->password) {
106 106
             $curlOpts[CURLOPT_USERPWD] = "$this->username:$this->password";
Please login to merge, or discard this patch.
src/ParallelDownloader.php 1 patch
Switch Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -116,46 +116,46 @@
 block discarded – undo
116 116
             // wait for any event
117 117
             do {
118 118
                 switch (curl_multi_select($mh, 5)) {
119
-                case -1:
120
-                    usleep(10);
121
-                    do {
122
-                        $stat = curl_multi_exec($mh, $running);
123
-                    } while ($stat === CURLM_CALL_MULTI_PERFORM);
124
-                    continue 2;
125
-                case 0:
126
-                    continue 2;
127
-                default:
128
-                    do {
129
-                        $stat = curl_multi_exec($mh, $running);
130
-                    } while ($stat === CURLM_CALL_MULTI_PERFORM);
131
-
132
-                    do {
133
-                        if ($raised = curl_multi_info_read($mh, $remains)) {
134
-                            $ch = $raised['handle'];
135
-                            $errno = curl_errno($ch);
136
-                            $info = curl_getinfo($ch);
137
-                            curl_setopt($ch, CURLOPT_FILE, STDOUT);
138
-                            $index = (int)$ch;
139
-                            $fileinfo = $chFpMap[$index];
140
-                            unset($chFpMap[$index]);
141
-                            $fp = $fileinfo['fp'];
142
-                            $filepath = $fileinfo['filepath'];
143
-                            fclose($fp);
144
-                            if (CURLE_OK === $errno && 200 === $info['http_code']) {
145
-                                ++$this->successCnt;
146
-                            } else {
147
-                                ++$this->failureCnt;
148
-                                unlink($filepath);
119
+                    case -1:
120
+                        usleep(10);
121
+                        do {
122
+                            $stat = curl_multi_exec($mh, $running);
123
+                        } while ($stat === CURLM_CALL_MULTI_PERFORM);
124
+                        continue 2;
125
+                    case 0:
126
+                        continue 2;
127
+                    default:
128
+                        do {
129
+                            $stat = curl_multi_exec($mh, $running);
130
+                        } while ($stat === CURLM_CALL_MULTI_PERFORM);
131
+
132
+                        do {
133
+                            if ($raised = curl_multi_info_read($mh, $remains)) {
134
+                                $ch = $raised['handle'];
135
+                                $errno = curl_errno($ch);
136
+                                $info = curl_getinfo($ch);
137
+                                curl_setopt($ch, CURLOPT_FILE, STDOUT);
138
+                                $index = (int)$ch;
139
+                                $fileinfo = $chFpMap[$index];
140
+                                unset($chFpMap[$index]);
141
+                                $fp = $fileinfo['fp'];
142
+                                $filepath = $fileinfo['filepath'];
143
+                                fclose($fp);
144
+                                if (CURLE_OK === $errno && 200 === $info['http_code']) {
145
+                                    ++$this->successCnt;
146
+                                } else {
147
+                                    ++$this->failureCnt;
148
+                                    unlink($filepath);
149
+                                }
150
+                                $this->io->write($this->makeDownloadingText($info['url']));
151
+                                curl_multi_remove_handle($mh, $ch);
152
+                                $unused[] = $ch;
149 153
                             }
150
-                            $this->io->write($this->makeDownloadingText($info['url']));
151
-                            curl_multi_remove_handle($mh, $ch);
152
-                            $unused[] = $ch;
153
-                        }
154
-                    } while ($remains);
154
+                        } while ($remains);
155 155
 
156
-                    if ($packages) {
157
-                        break 2;
158
-                    }
156
+                        if ($packages) {
157
+                            break 2;
158
+                        }
159 159
             }
160 160
             } while ($running);
161 161
         } while ($packages);
Please login to merge, or discard this patch.