mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-02 20:25:28 +00:00
This should remove some issues from scrutinizer.
This commit is contained in:
@@ -34,25 +34,25 @@ class BudgetEventHandler
|
|||||||
/**
|
/**
|
||||||
* This method creates a new budget limit repetition when a new budget limit has been created.
|
* This method creates a new budget limit repetition when a new budget limit has been created.
|
||||||
*
|
*
|
||||||
* @param StoredBudgetLimit $event
|
* @param StoredBudgetLimit $budgetLimitEvent
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function storeRepetition(StoredBudgetLimit $event):bool
|
public function storeRepetition(StoredBudgetLimit $budgetLimitEvent):bool
|
||||||
{
|
{
|
||||||
return $this->processRepetitionChange($event->budgetLimit, $event->end);
|
return $this->processRepetitionChange($budgetLimitEvent->budgetLimit, $budgetLimitEvent->end);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates, if present the budget limit repetition part of a budget limit.
|
* Updates, if present the budget limit repetition part of a budget limit.
|
||||||
*
|
*
|
||||||
* @param UpdatedBudgetLimit $event
|
* @param UpdatedBudgetLimit $budgetLimitEvent
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function updateRepetition(UpdatedBudgetLimit $event): bool
|
public function updateRepetition(UpdatedBudgetLimit $budgetLimitEvent): bool
|
||||||
{
|
{
|
||||||
return $this->processRepetitionChange($event->budgetLimit, $event->end);
|
return $this->processRepetitionChange($budgetLimitEvent->budgetLimit, $budgetLimitEvent->end);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -33,15 +33,15 @@ class StoredJournalEventHandler
|
|||||||
/**
|
/**
|
||||||
* This method connects a new transfer to a piggy bank.
|
* This method connects a new transfer to a piggy bank.
|
||||||
*
|
*
|
||||||
* @param StoredTransactionJournal $event
|
* @param StoredTransactionJournal $storedJournalEvent
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function connectToPiggyBank(StoredTransactionJournal $event): bool
|
public function connectToPiggyBank(StoredTransactionJournal $storedJournalEvent): bool
|
||||||
{
|
{
|
||||||
/** @var TransactionJournal $journal */
|
/** @var TransactionJournal $journal */
|
||||||
$journal = $event->journal;
|
$journal = $storedJournalEvent->journal;
|
||||||
$piggyBankId = $event->piggyBankId;
|
$piggyBankId = $storedJournalEvent->piggyBankId;
|
||||||
|
|
||||||
Log::debug(sprintf('Trying to connect journal %d to piggy bank %d.', $journal->id, $piggyBankId));
|
Log::debug(sprintf('Trying to connect journal %d to piggy bank %d.', $journal->id, $piggyBankId));
|
||||||
|
|
||||||
@@ -101,11 +101,11 @@ class StoredJournalEventHandler
|
|||||||
$repetition->currentamount = bcadd($repetition->currentamount, $amount);
|
$repetition->currentamount = bcadd($repetition->currentamount, $amount);
|
||||||
$repetition->save();
|
$repetition->save();
|
||||||
|
|
||||||
/** @var PiggyBankEvent $event */
|
/** @var PiggyBankEvent $storedJournalEvent */
|
||||||
$event = PiggyBankEvent::create(
|
$storedJournalEvent = PiggyBankEvent::create(
|
||||||
['piggy_bank_id' => $piggyBank->id, 'transaction_journal_id' => $journal->id, 'date' => $journal->date, 'amount' => $amount]
|
['piggy_bank_id' => $piggyBank->id, 'transaction_journal_id' => $journal->id, 'date' => $journal->date, 'amount' => $amount]
|
||||||
);
|
);
|
||||||
Log::debug(sprintf('Created piggy bank event #%d', $event->id));
|
Log::debug(sprintf('Created piggy bank event #%d', $storedJournalEvent->id));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -113,14 +113,14 @@ class StoredJournalEventHandler
|
|||||||
/**
|
/**
|
||||||
* This method grabs all the users rules and processes them.
|
* This method grabs all the users rules and processes them.
|
||||||
*
|
*
|
||||||
* @param StoredTransactionJournal $event
|
* @param StoredTransactionJournal $storedJournalEvent
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function processRules(StoredTransactionJournal $event): bool
|
public function processRules(StoredTransactionJournal $storedJournalEvent): bool
|
||||||
{
|
{
|
||||||
// get all the user's rule groups, with the rules, order by 'order'.
|
// get all the user's rule groups, with the rules, order by 'order'.
|
||||||
$journal = $event->journal;
|
$journal = $storedJournalEvent->journal;
|
||||||
$groups = $journal->user->ruleGroups()->where('rule_groups.active', 1)->orderBy('order', 'ASC')->get();
|
$groups = $journal->user->ruleGroups()->where('rule_groups.active', 1)->orderBy('order', 'ASC')->get();
|
||||||
//
|
//
|
||||||
/** @var RuleGroup $group */
|
/** @var RuleGroup $group */
|
||||||
@@ -150,13 +150,13 @@ class StoredJournalEventHandler
|
|||||||
/**
|
/**
|
||||||
* This method calls a special bill scanner that will check if the stored journal is part of a bill.
|
* This method calls a special bill scanner that will check if the stored journal is part of a bill.
|
||||||
*
|
*
|
||||||
* @param StoredTransactionJournal $event
|
* @param StoredTransactionJournal $storedJournalEvent
|
||||||
*
|
*
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function scanBills(StoredTransactionJournal $event): bool
|
public function scanBills(StoredTransactionJournal $storedJournalEvent): bool
|
||||||
{
|
{
|
||||||
$journal = $event->journal;
|
$journal = $storedJournalEvent->journal;
|
||||||
BillScanner::scan($journal);
|
BillScanner::scan($journal);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user