mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-10-10 14:05:32 +00:00
Clean up per PSR2
This commit is contained in:
@@ -4,7 +4,7 @@ require __DIR__ . '/vendor/autoload.php';
|
||||
use \Curl\Curl;
|
||||
|
||||
$curl = new Curl();
|
||||
$curl->progress(function($client, $download_size, $downloaded, $upload_size, $uploaded) {
|
||||
$curl->progress(function ($client, $download_size, $downloaded, $upload_size, $uploaded) {
|
||||
if ($download_size === 0) {
|
||||
return;
|
||||
}
|
||||
@@ -13,18 +13,18 @@ $curl->progress(function($client, $download_size, $downloaded, $upload_size, $up
|
||||
$progress_size = 40;
|
||||
$fraction_downloaded = $downloaded / $download_size;
|
||||
$dots = round($fraction_downloaded * $progress_size);
|
||||
printf('%3.0f%% [', $fraction_downloaded * 100 );
|
||||
printf('%3.0f%% [', $fraction_downloaded * 100);
|
||||
$i = 0;
|
||||
for ( ; $i < $dots - 1; $i++) {
|
||||
for (; $i < $dots - 1; $i++) {
|
||||
echo '=';
|
||||
}
|
||||
echo '>';
|
||||
for ( ; $i < $progress_size - 1; $i++) {
|
||||
for (; $i < $progress_size - 1; $i++) {
|
||||
echo ' ';
|
||||
}
|
||||
echo ']' . "\r";
|
||||
});
|
||||
$curl->complete(function($instance) {
|
||||
$curl->complete(function ($instance) {
|
||||
echo "\n" . 'download complete' . "\n";
|
||||
});
|
||||
$curl->download('https://secure.php.net/distributions/manual/php_manual_en.html.gz', '/tmp/php_manual_en.html.gz');
|
||||
|
||||
Reference in New Issue
Block a user