Error stacktrace with --dev enabled while conversion is in progress
Also shorter constants.
This commit is contained in:
@@ -58,7 +58,7 @@ abstract class AbstractConverter implements ConverterContract
|
||||
*/
|
||||
protected function prepareOutputDir(string $outputPath): void
|
||||
{
|
||||
$outputPath = sprintf('%s%s%s', $outputPath, DIRECTORY_SEPARATOR, static::OUTPUT_DIR);
|
||||
$outputPath = sprintf('%s%s%s', $outputPath, DS, static::OUTPUT_DIR);
|
||||
$this->outputPath = FileSystem::makeDir($outputPath);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ abstract class AbstractConverter implements ConverterContract
|
||||
static $dir_tree;
|
||||
foreach ($item->item as $subitem) {
|
||||
$dir_tree[] = $item->name;
|
||||
$path = implode(DIRECTORY_SEPARATOR, $dir_tree);
|
||||
$path = implode(DS, $dir_tree);
|
||||
if ($this->isItemFolder($subitem)) {
|
||||
$this->convertItem($subitem);
|
||||
} else {
|
||||
@@ -181,9 +181,9 @@ abstract class AbstractConverter implements ConverterContract
|
||||
*/
|
||||
protected function writeRequest(RequestContract $request, string $subpath = null): bool
|
||||
{
|
||||
$filedir = sprintf('%s%s%s', $this->outputPath, DIRECTORY_SEPARATOR, $subpath);
|
||||
$filedir = sprintf('%s%s%s', $this->outputPath, DS, $subpath);
|
||||
$filedir = FileSystem::makeDir($filedir);
|
||||
$filepath = sprintf('%s%s%s.%s', $filedir, DIRECTORY_SEPARATOR, $request->getName(), static::FILE_EXT);
|
||||
$filepath = sprintf('%s%s%s.%s', $filedir, DS, $request->getName(), static::FILE_EXT);
|
||||
$content = $this->interpolate((string)$request);
|
||||
return file_put_contents($filepath, $content) > 0;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ abstract class AbstractRequest implements Stringable, RequestContract
|
||||
*/
|
||||
public function getName(): string
|
||||
{
|
||||
return str_replace(DIRECTORY_SEPARATOR, '_', $this->name);
|
||||
return str_replace(DS, '_', $this->name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -78,6 +78,6 @@ class CurlRequest extends AbstractRequest
|
||||
$this->prepareBody()
|
||||
);
|
||||
$output[] = rtrim(array_pop($output), '\ ');
|
||||
return implode(PHP_EOL, array_merge($output, ['']));
|
||||
return implode(EOL, array_merge($output, ['']));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,6 @@ class HttpRequest extends AbstractRequest
|
||||
$this->prepareHeaders(),
|
||||
$this->prepareBody()
|
||||
);
|
||||
return implode(PHP_EOL, $output);
|
||||
return implode(EOL, $output);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class Postman20Converter extends AbstractConverter implements ConverterContract
|
||||
protected function writeCollection(): bool
|
||||
{
|
||||
$filedir = FileSystem::makeDir($this->outputPath);
|
||||
$filepath = sprintf('%s%s%s.%s', $filedir, DIRECTORY_SEPARATOR, $this->collection->name(), static::FILE_EXT);
|
||||
$filepath = sprintf('%s%s%s.%s', $filedir, DS, $this->collection->name(), static::FILE_EXT);
|
||||
return file_put_contents($filepath, $this->collection) > 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class Postman21Converter extends AbstractConverter implements ConverterContract
|
||||
protected function writeCollection(): bool
|
||||
{
|
||||
$filedir = FileSystem::makeDir($this->outputPath);
|
||||
$filepath = sprintf('%s%s%s.%s', $filedir, DIRECTORY_SEPARATOR, $this->collection->name(), static::FILE_EXT);
|
||||
$filepath = sprintf('%s%s%s.%s', $filedir, DS, $this->collection->name(), static::FILE_EXT);
|
||||
return file_put_contents($filepath, $this->collection) > 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,6 +89,6 @@ class WgetRequest extends AbstractRequest
|
||||
$output[] = sprintf("\t%s", $this->getUrl());
|
||||
}
|
||||
}
|
||||
return implode(PHP_EOL, array_merge($output, ['']));
|
||||
return implode(EOL, array_merge($output, ['']));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user