@@ -104,7 +104,9 @@ |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | if (count($options->queries) > 0) { |
107 | - if (!str_contains($uri, '?')) $uri .= '?'; |
|
107 | + if (!str_contains($uri, '?')) { |
|
108 | + $uri .= '?'; |
|
109 | + } |
|
108 | 110 | $uri .= $options->getQueryString(); |
109 | 111 | } |
110 | 112 |
@@ -426,7 +426,7 @@ |
||
426 | 426 | ] |
427 | 427 | ]); |
428 | 428 | |
429 | - return (int)$response->getHeaderLine('Content-Length') ?? 0; |
|
429 | + return (int) $response->getHeaderLine('Content-Length') ?? 0; |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | /** |
@@ -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 | } |
@@ -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'; |
@@ -90,7 +90,9 @@ |
||
90 | 90 | */ |
91 | 91 | public function getCurlInfo(): CurlInfo|false |
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 |
@@ -132,7 +132,9 @@ |
||
132 | 132 | public function save(string $filePath): bool |
133 | 133 | { |
134 | 134 | $pathInfo = pathinfo($filePath, PATHINFO_DIRNAME); |
135 | - if (gettype($pathInfo) != "string") $pathInfo = $pathInfo['dirname']; |
|
135 | + if (gettype($pathInfo) != "string") { |
|
136 | + $pathInfo = $pathInfo['dirname']; |
|
137 | + } |
|
136 | 138 | if (!file_exists($pathInfo)) { |
137 | 139 | throw new \InvalidArgumentException('The directory does not exist'); |
138 | 140 | } |