Code cleanup and realign.

This commit is contained in:
James Cole
2018-08-06 19:14:30 +02:00
parent f7eef25fed
commit 5908c0ce8c
188 changed files with 1019 additions and 1031 deletions

View File

@@ -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');

View File

@@ -22,6 +22,7 @@
declare(strict_types=1);
namespace FireflyIII\Support\Import\JobConfiguration\Ynab;
use FireflyIII\Models\ImportJob;
use Illuminate\Support\MessageBag;

View File

@@ -147,6 +147,7 @@ class ImportableConverter
Log::error($e->getTraceAsString());
}
}
return $result;
}

View File

@@ -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));
}

View File

@@ -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);

View File

@@ -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.');
}
}