diff --git a/app/Console/AutoImports.php b/app/Console/AutoImports.php index 396218c5..f9c89a55 100644 --- a/app/Console/AutoImports.php +++ b/app/Console/AutoImports.php @@ -190,7 +190,7 @@ private function importFiles(string $directory, array $files): array $this->importMessages = []; $this->importWarnings = []; } - Log::debug(sprintf('Collection of exit codes: %s', join(', ', array_values($exitCodes)))); + Log::debug(sprintf('Collection of exit codes: %s', implode(', ', array_values($exitCodes)))); return $exitCodes; } @@ -222,6 +222,7 @@ private function importFile(string $directory, string $file): int if (!$jsonFileExists && !$hasFallbackConfig) { $this->error(sprintf('No JSON configuration found. Checked for both "%s" and "%s"', $jsonFile, $fallbackJsonFile)); app('log')->error(sprintf('Exit code is %s.', ExitCode::CANNOT_READ_CONFIG->name)); + return ExitCode::CANNOT_READ_CONFIG->value; } @@ -236,6 +237,7 @@ private function importFile(string $directory, string $file): int $message = sprintf('The importer can\'t import %s: could not decode the JSON in config file %s.', $importableFile, $jsonFile); $this->error($message); app('log')->error(sprintf('Exit code is %s.', ExitCode::CANNOT_PARSE_CONFIG->name)); + return ExitCode::CANNOT_PARSE_CONFIG->value; } $configuration = Configuration::fromArray(json_decode(file_get_contents($jsonFile), true)); @@ -246,6 +248,7 @@ private function importFile(string $directory, string $file): int // don't report this. app('log')->debug(sprintf('Exit code is %s.', ExitCode::SUCCESS->name)); + return ExitCode::SUCCESS->value; } @@ -270,6 +273,7 @@ private function importFile(string $directory, string $file): int ) ); app('log')->debug(sprintf('Exit code is %s.', ExitCode::TOO_MANY_ERRORS_PROCESSING->name)); + return ExitCode::TOO_MANY_ERRORS_PROCESSING->value; } diff --git a/app/Console/Commands/Import.php b/app/Console/Commands/Import.php index 95d17f8f..f730c014 100644 --- a/app/Console/Commands/Import.php +++ b/app/Console/Commands/Import.php @@ -171,7 +171,7 @@ public function handle(): int $exitCode = ExitCode::NOTHING_WAS_IMPORTED->value; app('log')->error(sprintf('Exit code is %s.', ExitCode::NOTHING_WAS_IMPORTED->name)); } - if($exitCode === ExitCode::SUCCESS->value) { + if ($exitCode === ExitCode::SUCCESS->value) { app('log')->debug(sprintf('Exit code is %s.', ExitCode::SUCCESS->name)); }