8 Commits

Author SHA1 Message Date
d854732143 Merge pull request 'dev' (#7) from dev into master
Reviewed-on: #7
2023-08-13 15:12:22 +00:00
9b021296eb Bump version 2023-08-13 23:11:52 +08:00
d581afa793 Fixed non-existent env when interpolating vars 2023-08-13 23:11:37 +08:00
95ca655eb0 Merge pull request 'v1.2.2' (#5) from dev into master
Reviewed-on: #5
2023-08-13 03:04:03 +00:00
25887a47d3 Bump version 2023-08-13 11:02:59 +08:00
1f7816c917 When env was no set then dont try to collect vars from it
(cherry picked from commit fa8ad15fdd691fb4ea5db431062e89b512a9d526)
2023-08-13 11:02:08 +08:00
fb7b4baa32 Fixed wget file format
(cherry picked from commit 0febfd38aa3047555d34f7e125adb3773ee8a2da)
2023-08-13 11:02:07 +08:00
2c4eedbf8b When collection has no vars then dont try to collect them
(cherry picked from commit ee7528186f69e811b1b4db8e69ea2e4ec0ea2613)
2023-08-13 11:02:07 +08:00
3 changed files with 7 additions and 5 deletions

View File

@@ -71,7 +71,7 @@ abstract class AbstractConverter implements ConverterContract
*/
protected function setVariables(): static
{
if ($this->collection->variable) {
if (isset($this->collection?->variable)) {
foreach ($this->collection->variable as $var) {
$this->vars["{{{$var->key}}}"] = $var->value;
}
@@ -173,7 +173,7 @@ abstract class AbstractConverter implements ConverterContract
*/
protected function interpolate(string $content): string
{
if (empty($this->vars) && $this->env->hasVars()) {
if (empty($this->vars) && !empty($this->env) && $this->env->hasVars()) {
return $content;
}
$matches = [];

View File

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

View File

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