mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Clean up code.
This commit is contained in:
@@ -140,6 +140,29 @@ class UpdatePiggyBank implements ActionInterface
|
||||
return $repository->findByName($name);
|
||||
}
|
||||
|
||||
private function getAccounts(TransactionJournal $journal): array
|
||||
{
|
||||
return [
|
||||
'source' => $journal->transactions()->where('amount', '<', '0')->first()?->account,
|
||||
'destination' => $journal->transactions()->where('amount', '>', '0')->first()?->account,
|
||||
];
|
||||
}
|
||||
|
||||
private function isConnected(PiggyBank $piggyBank, ?Account $link): bool
|
||||
{
|
||||
if (null === $link) {
|
||||
return false;
|
||||
}
|
||||
foreach ($piggyBank->accounts as $account) {
|
||||
if ($account->id === $link->id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Log::debug(sprintf('Piggy bank is not connected to account #%d "%s"', $link->id, $link->name));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function removeAmount(PiggyBank $piggyBank, array $array, TransactionJournal $journal, Account $account, string $amount): void
|
||||
{
|
||||
$repository = app(PiggyBankRepositoryInterface::class);
|
||||
@@ -208,27 +231,4 @@ class UpdatePiggyBank implements ActionInterface
|
||||
|
||||
$repository->addAmount($piggyBank, $account, $amount, $journal);
|
||||
}
|
||||
|
||||
private function getAccounts(TransactionJournal $journal): array
|
||||
{
|
||||
return [
|
||||
'source' => $journal->transactions()->where('amount', '<', '0')->first()?->account,
|
||||
'destination' => $journal->transactions()->where('amount', '>', '0')->first()?->account,
|
||||
];
|
||||
}
|
||||
|
||||
private function isConnected(PiggyBank $piggyBank, ?Account $link): bool
|
||||
{
|
||||
if (null === $link) {
|
||||
return false;
|
||||
}
|
||||
foreach ($piggyBank->accounts as $account) {
|
||||
if ($account->id === $link->id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Log::debug(sprintf('Piggy bank is not connected to account #%d "%s"', $link->id, $link->name));
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -45,11 +45,11 @@ use Illuminate\Support\Facades\Log;
|
||||
class SearchRuleEngine implements RuleEngineInterface
|
||||
{
|
||||
private readonly Collection $groups;
|
||||
private array $operators;
|
||||
private bool $refreshTriggers;
|
||||
private array $resultCount;
|
||||
private array $operators;
|
||||
private bool $refreshTriggers;
|
||||
private array $resultCount;
|
||||
private readonly Collection $rules;
|
||||
private User $user;
|
||||
private User $user;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
@@ -29,7 +29,7 @@ use Symfony\Component\ExpressionLanguage\SyntaxError;
|
||||
|
||||
class ActionExpression
|
||||
{
|
||||
private static array $NAMES
|
||||
private static array $NAMES
|
||||
= [
|
||||
// 'transaction_group_id',
|
||||
// 'user_id',
|
||||
|
Reference in New Issue
Block a user