mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Code cleanup and realign.
This commit is contained in:
@@ -59,7 +59,7 @@ class SelectBudgetHandler implements YnabJobConfigurationInterface
|
||||
Log::debug('Now in SelectBudgetHandler::configComplete');
|
||||
$configuration = $this->repository->getConfiguration($this->importJob);
|
||||
$selectedBudget = $configuration['selected_budget'] ?? '';
|
||||
if ($selectedBudget !== '') {
|
||||
if ('' !== $selectedBudget) {
|
||||
Log::debug(sprintf('Selected budget is %s, config is complete. Return true.', $selectedBudget));
|
||||
$this->repository->setStage($this->importJob, 'get_accounts');
|
||||
|
||||
|
@@ -22,6 +22,7 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Import\JobConfiguration\Ynab;
|
||||
|
||||
use FireflyIII\Models\ImportJob;
|
||||
use Illuminate\Support\MessageBag;
|
||||
|
||||
|
@@ -147,6 +147,7 @@ class ImportableConverter
|
||||
Log::error($e->getTraceAsString());
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@@ -150,7 +150,7 @@ class ImportDataHandler
|
||||
$destination = $this->mapper->map($possibleDestinationId, $amount, $destinationData);
|
||||
if (1 === bccomp($amount, '0')) {
|
||||
[$source, $destination] = [$destination, $source];
|
||||
$type = $type === 'transfer' ? 'transfer' : 'deposit';
|
||||
$type = 'transfer' === $type ? 'transfer' : 'deposit';
|
||||
Log::debug(sprintf('Amount is %s, so switch source/dest and make this a %s', $amount, $type));
|
||||
}
|
||||
|
||||
|
@@ -70,14 +70,14 @@ class StageGetAccessHandler
|
||||
}
|
||||
$statusCode = $res->getStatusCode();
|
||||
try {
|
||||
$content = trim($res->getBody()->getContents());
|
||||
} catch(RuntimeException $e) {
|
||||
$content = trim($res->getBody()->getContents());
|
||||
} catch (RuntimeException $e) {
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
throw new FireflyException($e->getMessage());
|
||||
}
|
||||
|
||||
$json = json_decode($content, true) ?? [];
|
||||
$json = json_decode($content, true) ?? [];
|
||||
Log::debug(sprintf('Status code from YNAB is %d', $statusCode));
|
||||
Log::debug(sprintf('Body of result is %s', $content), $json);
|
||||
|
||||
|
@@ -58,7 +58,7 @@ class StageGetBudgetsHandler
|
||||
$configuration['budgets'] = $request->budgets;
|
||||
$this->repository->setConfiguration($this->importJob, $configuration);
|
||||
Log::debug(sprintf('Found %d budgets', \count($request->budgets)));
|
||||
if (\count($request->budgets) === 0) {
|
||||
if (0 === \count($request->budgets)) {
|
||||
throw new FireflyException('It seems this user has zero budgets or an error prevented Firefly III from reading them.');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user