Merge pull request 'v1.2.2' (#5) from dev into master

Reviewed-on: #5
This commit is contained in:
Anthony Axenov 2023-08-13 03:04:03 +00:00
commit 95ca655eb0
3 changed files with 6 additions and 4 deletions

View File

@ -71,7 +71,7 @@ abstract class AbstractConverter implements ConverterContract
*/ */
protected function setVariables(): static protected function setVariables(): static
{ {
if ($this->collection->variable) { if (isset($this->collection?->variable)) {
foreach ($this->collection->variable as $var) { foreach ($this->collection->variable as $var) {
$this->vars["{{{$var->key}}}"] = $var->value; $this->vars["{{{$var->key}}}"] = $var->value;
} }

View File

@ -53,7 +53,7 @@ class WgetRequest extends AbstractRequest
$output[] = http_build_query($params); $output[] = http_build_query($params);
return $output; return $output;
default: default:
return ["\t$this->body"]; return ["\t'$this->body' \ "];
} }
} }
@ -75,7 +75,6 @@ class WgetRequest extends AbstractRequest
$this->prepareHeaders(), $this->prepareHeaders(),
$this->prepareBody() $this->prepareBody()
); );
$output[] = rtrim(array_pop($output), '\ ');
$output[] = "\t'$this->url'"; $output[] = "\t'$this->url'";
return implode(PHP_EOL, array_merge($output, [''])); return implode(PHP_EOL, array_merge($output, ['']));
} }

View File

@ -22,7 +22,7 @@ class Processor
/** /**
* Converter version * Converter version
*/ */
public const VERSION = '1.2.1'; public const VERSION = '1.2.2';
/** /**
* @var string[] Paths to collection files * @var string[] Paths to collection files
@ -229,6 +229,9 @@ class Processor
*/ */
protected function initEnv(): void protected function initEnv(): void
{ {
if (!isset($this->envFile)) {
return;
}
$content = file_get_contents(FileSystem::normalizePath($this->envFile)); $content = file_get_contents(FileSystem::normalizePath($this->envFile));
$content = json_decode($content, flags: JSON_THROW_ON_ERROR); $content = json_decode($content, flags: JSON_THROW_ON_ERROR);
if (!property_exists($content, 'environment') || empty($content?->environment)) { if (!property_exists($content, 'environment') || empty($content?->environment)) {