Initial and very naive conversion v2.0 => v2.1 (#10)
This commit is contained in:
@@ -54,7 +54,7 @@ class Processor
|
||||
protected array $converters = [];
|
||||
|
||||
/**
|
||||
* @var object[] Collections that will be converted into choosen formats
|
||||
* @var Collection[] Collections that will be converted into choosen formats
|
||||
*/
|
||||
protected array $collections = [];
|
||||
|
||||
@@ -93,6 +93,7 @@ class Processor
|
||||
* Parses an array of arguments came from cli
|
||||
*
|
||||
* @return void
|
||||
* @throws JsonException
|
||||
*/
|
||||
protected function parseArgs(): void
|
||||
{
|
||||
@@ -160,6 +161,10 @@ class Processor
|
||||
$this->formats[ConvertFormat::Postman20->name] = ConvertFormat::Postman20;
|
||||
break;
|
||||
|
||||
case '--v2.1':
|
||||
$this->formats[ConvertFormat::Postman21->name] = ConvertFormat::Postman21;
|
||||
break;
|
||||
|
||||
case '--var':
|
||||
[$var, $value] = explode('=', trim($this->argv[$idx + 1]));
|
||||
$this->vars[$var] = $value;
|
||||
@@ -297,8 +302,13 @@ class Processor
|
||||
protected function printStats(int $success, int $count): void
|
||||
{
|
||||
$time = (hrtime(true) - $this->initTime) / 1_000_000;
|
||||
$timeFmt = 'ms';
|
||||
if ($time > 1000) {
|
||||
$time /= 1000;
|
||||
$timeFmt = 'sec';
|
||||
}
|
||||
$ram = (memory_get_peak_usage(true) - $this->initRam) / 1024 / 1024;
|
||||
printf('Converted %d of %d in %.3f ms using up to %.3f MiB RAM%s', $success, $count, $time, $ram, PHP_EOL);
|
||||
printf("Converted %d/%d in %.2f $timeFmt using up to %.2f MiB RAM%s", $success, $count, $time, $ram, PHP_EOL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user