@@ -69,11 +69,15 @@ |
||
69 | 69 | { |
70 | 70 | if ($binaryPrefix) { |
71 | 71 | $unit = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'); |
72 | - if ($bytes == 0) return '0 ' . $unit[0]; |
|
72 | + if ($bytes == 0) { |
|
73 | + return '0 ' . $unit[0]; |
|
74 | + } |
|
73 | 75 | return @round($bytes / pow(1024, ($i = floor(log($bytes, 1024)))), 2) . ' ' . ($unit[$i] ?? 'B'); |
74 | 76 | } else { |
75 | 77 | $unit = array('B', 'KB', 'MB', 'GB', 'TB', 'PB'); |
76 | - if ($bytes == 0) return '0 ' . $unit[0]; |
|
78 | + if ($bytes == 0) { |
|
79 | + return '0 ' . $unit[0]; |
|
80 | + } |
|
77 | 81 | return @round($bytes / pow(1000, ($i = floor(log($bytes, 1000)))), 2) . ' ' . ($unit[$i] ?? 'B'); |
78 | 82 | } |
79 | 83 | } |
@@ -90,7 +90,9 @@ |
||
90 | 90 | */ |
91 | 91 | public function getCurlInfo(): CurlInfo |
92 | 92 | { |
93 | - if (empty($this->curlHandle)) return false; |
|
93 | + if (empty($this->curlHandle)) { |
|
94 | + return false; |
|
95 | + } |
|
94 | 96 | return new CurlInfo(curl_getinfo($this->curlHandle)); |
95 | 97 | } |
96 | 98 |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @return void |
370 | 370 | */ |
371 | - private function downloadChunk(DownloadResult &$result, HttpOptions $options, array $input): void |
|
371 | + private function downloadChunk(DownloadResult&$result, HttpOptions $options, array $input): void |
|
372 | 372 | { |
373 | 373 | $options->setCurlOptions([ |
374 | 374 | CURLOPT_RANGE => $input['range'] |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | ] |
399 | 399 | ]); |
400 | 400 | |
401 | - return (int)$response->getHeaderLine('Content-Length') ?? 0; |
|
401 | + return (int) $response->getHeaderLine('Content-Length') ?? 0; |
|
402 | 402 | } |
403 | 403 | |
404 | 404 | /** |
@@ -7,14 +7,18 @@ |
||
7 | 7 | |
8 | 8 | $client = new \EasyHttp\Client(); |
9 | 9 | |
10 | -if (!file_exists(__DIR__ . '/tmp')) mkdir(__DIR__ . '/tmp'); |
|
10 | +if (!file_exists(__DIR__ . '/tmp')) { |
|
11 | + mkdir(__DIR__ . '/tmp'); |
|
12 | +} |
|
11 | 13 | $client->setTempPath(__DIR__ . '/tmp'); |
12 | 14 | |
13 | 15 | $Result = $client->download($DirectLink); |
14 | 16 | |
15 | 17 | echo '<pre>' . json_encode($Result->downloads, JSON_PRETTY_PRINT) . '</pre>'; |
16 | 18 | |
17 | -if (!file_exists(__DIR__ . '/uploads')) mkdir(__DIR__ . '/uploads'); |
|
19 | +if (!file_exists(__DIR__ . '/uploads')) { |
|
20 | + mkdir(__DIR__ . '/uploads'); |
|
21 | +} |
|
18 | 22 | |
19 | 23 | if ($Result->save(__DIR__ . '/uploads/google.png')) { |
20 | 24 | echo 'File saved successfully'; |