Skip to content

Commit

Permalink
Auto commit for release 'develop' on 2024-11-23
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 23, 2024
1 parent 6389dcd commit afdd5b5
Show file tree
Hide file tree
Showing 4 changed files with 157 additions and 159 deletions.
21 changes: 11 additions & 10 deletions app/Console/Commands/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ final class Import extends Command
*
* @var string
*/
protected $signature = 'importer:import
protected $signature = 'importer:import
{config : The configuration file. }
{file? : Optionally, the importable file you want to import}
';
Expand All @@ -66,7 +66,7 @@ final class Import extends Command
*/
public function handle(): int
{
$access = $this->haveAccess();
$access = $this->haveAccess();
if (false === $access) {
$this->error(sprintf('No access granted, or no connection is possible to your local Firefly III instance at %s.', config('importer.url')));
app('log')->error(sprintf('Exit code is %s.', ExitCode::NO_CONNECTION->name));
Expand All @@ -76,8 +76,8 @@ public function handle(): int

$this->info(sprintf('Welcome to the Firefly III data importer, v%s', config('importer.version')));
app('log')->debug(sprintf('Now in %s', __METHOD__));
$file = (string) $this->argument('file');
$config = (string) $this->argument('config'); // @phpstan-ignore-line
$file = (string) $this->argument('file');
$config = (string) $this->argument('config'); // @phpstan-ignore-line

// validate config path:
if ('' !== $config) {
Expand Down Expand Up @@ -110,7 +110,7 @@ public function handle(): int
return ExitCode::CANNOT_READ_CONFIG->value;
}

$jsonResult = $this->verifyJSON($config);
$jsonResult = $this->verifyJSON($config);
if (false === $jsonResult) {
$message = 'The importer can\'t import: could not decode the JSON in the config file.';
$this->error($message);
Expand Down Expand Up @@ -142,13 +142,13 @@ public function handle(): int
$this->reportConversion();

// crash here if the conversion failed.
$exitCode = ExitCode::SUCCESS->value;
$exitCode = ExitCode::SUCCESS->value;
if (0 !== count($this->conversionErrors)) {
app('log')->error(sprintf('Exit code is %s.', ExitCode::TOO_MANY_ERRORS_PROCESSING->name));
$exitCode = ExitCode::TOO_MANY_ERRORS_PROCESSING->value;
// could still be that there were simply no transactions (from GoCardless). This can result
// in another exit code.
if($this->isNothingDownloaded()) {
if ($this->isNothingDownloaded()) {
app('log')->error(sprintf('Exit code changed to %s.', ExitCode::NOTHING_WAS_IMPORTED->name));
$exitCode = ExitCode::NOTHING_WAS_IMPORTED->value;
}
Expand All @@ -165,9 +165,9 @@ public function handle(): int
$this->reportBalanceDifferences($configuration);

// merge things:
$messages = array_merge($this->importMessages, $this->conversionMessages);
$warnings = array_merge($this->importWarnings, $this->conversionWarnings);
$errors = array_merge($this->importErrors, $this->conversionErrors);
$messages = array_merge($this->importMessages, $this->conversionMessages);
$warnings = array_merge($this->importWarnings, $this->conversionWarnings);
$errors = array_merge($this->importErrors, $this->conversionErrors);

event(new ImportedTransactions($messages, $warnings, $errors, $this->conversionRateLimits));
if (0 !== count($this->importErrors)) {
Expand Down Expand Up @@ -196,6 +196,7 @@ private function isNothingDownloaded(): bool
}
}
}

return false;
}
}
Loading

0 comments on commit afdd5b5

Please sign in to comment.