diff --git a/app/Console/Commands/HRCCommand.php b/app/Console/Commands/HRCCommand.php index 9519dc8..ded290f 100644 --- a/app/Console/Commands/HRCCommand.php +++ b/app/Console/Commands/HRCCommand.php @@ -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)