@@ -46,7 +46,7 @@ |
||
46 | 46 | * @param bool $auth |
47 | 47 | * @return resource<curl> |
48 | 48 | */ |
49 | - public static function getConnection($origin, $auth=false) |
|
49 | + public static function getConnection($origin, $auth = false) |
|
50 | 50 | { |
51 | 51 | $instance = self::getInstance(); |
52 | 52 | if ($auth) { |
@@ -63,7 +63,7 @@ discard block |
||
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 |
||
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 |
||
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"; |
@@ -104,7 +104,7 @@ |
||
104 | 104 | if ($pluginConfig['insecure']) { |
105 | 105 | $opts[CURLOPT_VERIFYPEER] = false; |
106 | 106 | } |
107 | - if (! empty($pluginConfig['capath'])) { |
|
107 | + if (!empty($pluginConfig['capath'])) { |
|
108 | 108 | $opts[CURLOPT_CAPATH] = $pluginConfig['capath']; |
109 | 109 | } |
110 | 110 | unset($opts[CURLOPT_ENCODING]); |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | $config = $this->config->get('prestissimo'); |
110 | - if (! is_array($config)) { |
|
110 | + if (!is_array($config)) { |
|
111 | 111 | $config = array(); |
112 | 112 | } |
113 | 113 | $config += array( |
@@ -120,22 +120,22 @@ discard block |
||
120 | 120 | 'privatePackages' => array(), |
121 | 121 | ); |
122 | 122 | |
123 | - if (! is_int($config['maxConnections']) || $config['maxConnections'] < 1) { |
|
123 | + if (!is_int($config['maxConnections']) || $config['maxConnections'] < 1) { |
|
124 | 124 | $config['maxConnections'] = 6; |
125 | 125 | } |
126 | - if (! is_int($config['minConnections']) || $config['minConnections'] > $config['maxConnections']) { |
|
126 | + if (!is_int($config['minConnections']) || $config['minConnections'] > $config['maxConnections']) { |
|
127 | 127 | $config['minConnections'] = 3; |
128 | 128 | } |
129 | - if (! is_bool($config['pipeline'])) { |
|
129 | + if (!is_bool($config['pipeline'])) { |
|
130 | 130 | $config['pipeline'] = (bool)$config['pipeline']; |
131 | 131 | } |
132 | - if (! is_bool($config['insecure'])) { |
|
132 | + if (!is_bool($config['insecure'])) { |
|
133 | 133 | $config['insecure'] = (bool)$config['insecure']; |
134 | 134 | } |
135 | - if (! is_string($config['capath'])) { |
|
135 | + if (!is_string($config['capath'])) { |
|
136 | 136 | $config['capath'] = ''; |
137 | 137 | } |
138 | - if (! is_array($config['privatePackages'])) { |
|
138 | + if (!is_array($config['privatePackages'])) { |
|
139 | 139 | $config['privatePackages'] = (array)$config['privatePackages']; |
140 | 140 | } |
141 | 141 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | fclose($this->fp); |
50 | 50 | } |
51 | 51 | |
52 | - if (! $this->success) { |
|
52 | + if (!$this->success) { |
|
53 | 53 | unlink($this->fileName); |
54 | 54 | foreach ($this->createdDirs as $dir) { |
55 | 55 | rmdir($dir); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | do { |
75 | 75 | $dir = dirname($dir); |
76 | 76 | $createdDirs[] = $dir; |
77 | - } while (! file_exists($dir)); |
|
77 | + } while (!file_exists($dir)); |
|
78 | 78 | array_pop($createdDirs); |
79 | 79 | $this->createdDirs = array_reverse($createdDirs); |
80 | 80 |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return bool true |
66 | 66 | */ |
67 | - public function copy($origin, $fileUrl, $fileName, $progress=true, $options=array()) |
|
67 | + public function copy($origin, $fileUrl, $fileName, $progress = true, $options = array()) |
|
68 | 68 | { |
69 | 69 | $that = $this; // for PHP5.3 |
70 | 70 | |
71 | - return $this->fetch($origin, $fileUrl, $progress, $options, function ($ch, $request) use ($that, $fileName) { |
|
71 | + return $this->fetch($origin, $fileUrl, $progress, $options, function($ch, $request) use ($that, $fileName) { |
|
72 | 72 | $outputFile = new OutputFile($fileName); |
73 | 73 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); |
74 | 74 | curl_setopt($ch, CURLOPT_FILE, $outputFile->getPointer()); |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @return bool|string The content |
97 | 97 | */ |
98 | - public function getContents($origin, $fileUrl, $progress=true, $options=array()) |
|
98 | + public function getContents($origin, $fileUrl, $progress = true, $options = array()) |
|
99 | 99 | { |
100 | 100 | $that = $this; // for PHP5.3 |
101 | 101 | |
102 | - return $this->fetch($origin, $fileUrl, $progress, $options, function ($ch, $request) use ($that) { |
|
102 | + return $this->fetch($origin, $fileUrl, $progress, $options, function($ch, $request) use ($that) { |
|
103 | 103 | // This order is important. |
104 | 104 | curl_setopt($ch, CURLOPT_FILE, STDOUT); |
105 | 105 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
@@ -154,13 +154,13 @@ discard block |
||
154 | 154 | if ($this->pluginConfig['insecure']) { |
155 | 155 | $opts[CURLOPT_SSL_VERIFYPEER] = false; |
156 | 156 | } |
157 | - if (! empty($pluginConfig['capath'])) { |
|
157 | + if (!empty($pluginConfig['capath'])) { |
|
158 | 158 | $opts[CURLOPT_CAPATH] = $pluginConfig['capath']; |
159 | 159 | } |
160 | 160 | |
161 | 161 | curl_setopt_array($ch, $opts); |
162 | 162 | |
163 | - list($execStatus, ) = $exec($ch, $request); |
|
163 | + list($execStatus,) = $exec($ch, $request); |
|
164 | 164 | } while ($this->_retry); |
165 | 165 | |
166 | 166 | if ($progress) { |
@@ -224,9 +224,9 @@ discard block |
||
224 | 224 | { |
225 | 225 | // @codeCoverageIgnoreStart |
226 | 226 | if (PHP_VERSION_ID >= 50500) { |
227 | - list(, $downBytesMax, $downBytes, , ) = func_get_args(); |
|
227 | + list(, $downBytesMax, $downBytes,,) = func_get_args(); |
|
228 | 228 | } else { |
229 | - list($downBytesMax, $downBytes, , ) = func_get_args(); |
|
229 | + list($downBytesMax, $downBytes,,) = func_get_args(); |
|
230 | 230 | } |
231 | 231 | // @codeCoverageIgnoreEnd |
232 | 232 |