mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Optimised some code.
This commit is contained in:
@@ -32,17 +32,13 @@ class AccountId extends BasicConverter implements ConverterInterface
|
||||
{
|
||||
$value = intval(trim($value));
|
||||
Log::debug('Going to convert using AssetAccountId', ['value' => $value]);
|
||||
|
||||
if ($value === 0) {
|
||||
$this->setCertainty(0);
|
||||
|
||||
return new Account;
|
||||
}
|
||||
|
||||
/** @var AccountCrudInterface $repository */
|
||||
$repository = app(AccountCrudInterface::class, [$this->user]);
|
||||
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
Log::debug('Found account in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
|
||||
$account = $repository->find(intval($this->mapping[$value]));
|
||||
@@ -54,20 +50,15 @@ class AccountId extends BasicConverter implements ConverterInterface
|
||||
return $account;
|
||||
}
|
||||
}
|
||||
|
||||
// not mapped? Still try to find it first:
|
||||
$account = $repository->find($value);
|
||||
$account = $repository->find($value);// not mapped? Still try to find it first:
|
||||
if (!is_null($account->id)) {
|
||||
$this->setCertainty(90);
|
||||
|
||||
Log::debug('Found account by ID ', ['id' => $account->id]);
|
||||
|
||||
return $account;
|
||||
}
|
||||
$this->setCertainty(0); // should not really happen. If the ID does not match FF, what is FF supposed to do?
|
||||
|
||||
$this->setCertainty(0);
|
||||
|
||||
// should not really happen. If the ID does not match FF, what is FF supposed to do?
|
||||
return new Account;
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ class CurrencySymbol extends BasicConverter implements ConverterInterface
|
||||
$value = trim($value);
|
||||
Log::debug('Going to convert using CurrencySymbol', ['value' => $value]);
|
||||
|
||||
if ($value === 0) {
|
||||
if (strlen($value) === 0) {
|
||||
$this->setCertainty(0);
|
||||
return new TransactionCurrency;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user