Add null variables

This commit is contained in:
2021-01-27 16:43:36 +03:00
parent 0ada203f11
commit e1fa0ececb

View File

@@ -30,23 +30,29 @@ class HRCCommand extends Command
private function prepareInput()
{
$source_file = CORE_PATH . '/temp/' . $this->argument('source');
$data = parse_ini_file($source_file);
if($this->argument('source') != 'null') {
$source_file = CORE_PATH . '/temp/' . $this->argument('source');
$data = parse_ini_file($source_file);
if(isset($data['raw_result'])) {
unset($data['raw_result']);
if (isset($data['raw_result'])) {
unset($data['raw_result']);
}
return $data;
}
return $data;
return [];
}
private function prepareOutput()
{
$source_file = CORE_PATH . '/temp/' . $this->argument('source');
$data = parse_ini_file($source_file);
if($this->argument('source') != 'null') {
$source_file = CORE_PATH . '/temp/' . $this->argument('source');
$data = parse_ini_file($source_file);
if(isset($data['raw_result'])) {
return json_decode(base64_decode($data['raw_result']), true);
if (isset($data['raw_result'])) {
return json_decode(base64_decode($data['raw_result']), true);
}
}
return null;
@@ -54,8 +60,10 @@ class HRCCommand extends Command
public function save($result)
{
$result_file = CORE_PATH . '/temp/' . $this->argument('result');
file_put_contents($result_file, json_encode($result));
if($this->argument('result') != 'null') {
$result_file = CORE_PATH . '/temp/' . $this->argument('result');
file_put_contents($result_file, json_encode($result));
}
}
private function getCoreConfig($name, $default = null)