Updated method \ncc\Utilities > HttpClient > displayProgress()

This commit is contained in:
Netkas 2022-12-16 00:21:26 -05:00
parent 7099b02514
commit 344454e8c4

View file

@ -4,6 +4,8 @@
use CurlHandle; use CurlHandle;
use ncc\Abstracts\HttpRequestType; use ncc\Abstracts\HttpRequestType;
use ncc\Abstracts\LogLevel;
use ncc\CLI\Main;
use ncc\Exceptions\HttpException; use ncc\Exceptions\HttpException;
use ncc\Objects\HttpRequest; use ncc\Objects\HttpRequest;
use ncc\Objects\HttpResponse; use ncc\Objects\HttpResponse;
@ -176,8 +178,24 @@
*/ */
public static function displayProgress($resource, $downloadSize, $downloaded, $uploadSize, $uploaded): void public static function displayProgress($resource, $downloadSize, $downloaded, $uploadSize, $uploaded): void
{ {
if(Main::getLogLevel() !== null)
{
switch(Main::getLogLevel())
{
case LogLevel::Verbose:
case LogLevel::Debug:
case LogLevel::Silent:
Console::outVerbose(sprintf(' <= %s of %s bytes downloaded', $downloaded, $downloadSize));
break;
default:
if ($downloadSize > 0) if ($downloadSize > 0)
Console::inlineProgressBar($downloaded, $downloadSize); Console::inlineProgressBar($downloaded, $downloadSize);
break;
}
}
} }
/** /**