mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 22:21:42 +00:00
Use PSR-12 code style
This commit is contained in:
@@ -57,7 +57,7 @@ class AppendDescriptionToNotes implements ActionInterface
|
||||
}
|
||||
$note = $object->notes()->first();
|
||||
if (null === $note) {
|
||||
$note = new Note;
|
||||
$note = new Note();
|
||||
$note->noteable()->associate($object);
|
||||
$note->text = '';
|
||||
}
|
||||
|
||||
@@ -50,13 +50,11 @@ class AppendNotes implements ActionInterface
|
||||
*/
|
||||
public function actOnArray(array $journal): bool
|
||||
{
|
||||
$dbNote = Note
|
||||
::
|
||||
where('noteable_id', (int) $journal['transaction_journal_id'])
|
||||
$dbNote = Note::where('noteable_id', (int) $journal['transaction_journal_id'])
|
||||
->where('noteable_type', TransactionJournal::class)
|
||||
->first(['notes.*']);
|
||||
if (null === $dbNote) {
|
||||
$dbNote = new Note;
|
||||
$dbNote = new Note();
|
||||
$dbNote->noteable_id = (int) $journal['transaction_journal_id'];
|
||||
$dbNote->noteable_type = TransactionJournal::class;
|
||||
$dbNote->text = '';
|
||||
|
||||
@@ -65,7 +65,7 @@ class AppendNotesToDescription implements ActionInterface
|
||||
$note = $object->notes()->first();
|
||||
if (null === $note) {
|
||||
Log::debug('Journal has no notes.');
|
||||
$note = new Note;
|
||||
$note = new Note();
|
||||
$note->noteable()->associate($object);
|
||||
$note->text = '';
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ use Log;
|
||||
*/
|
||||
class ClearBudget implements ActionInterface
|
||||
{
|
||||
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
|
||||
@@ -82,8 +82,10 @@ class ConvertToTransfer implements ActionInterface
|
||||
if (null === $asset) {
|
||||
Log::error(
|
||||
sprintf(
|
||||
'Journal #%d cannot be converted because no asset with name "%s" exists (rule #%d).', $journal['transaction_journal_id'],
|
||||
$this->action->action_value, $this->action->rule_id
|
||||
'Journal #%d cannot be converted because no asset with name "%s" exists (rule #%d).',
|
||||
$journal['transaction_journal_id'],
|
||||
$this->action->action_value,
|
||||
$this->action->rule_id
|
||||
)
|
||||
);
|
||||
|
||||
@@ -187,5 +189,4 @@ class ConvertToTransfer implements ActionInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -121,7 +121,6 @@ class ConvertToWithdrawal implements ActionInterface
|
||||
Log::debug('Converted deposit to withdrawal.');
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,7 +59,8 @@ class DeleteTransaction implements ActionInterface
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'RuleAction DeleteTransaction DELETED the entire transaction group of journal #%d ("%s").',
|
||||
$journal['transaction_journal_id'], $journal['description']
|
||||
$journal['transaction_journal_id'],
|
||||
$journal['description']
|
||||
)
|
||||
);
|
||||
$group = TransactionGroup::find($journal['transaction_group_id']);
|
||||
|
||||
@@ -87,7 +87,8 @@ class LinkToBill implements ActionInterface
|
||||
Log::error(
|
||||
sprintf(
|
||||
'RuleAction LinkToBill could not set the bill of journal #%d to bill "%s": no such bill found or not a withdrawal.',
|
||||
$journal['transaction_journal_id'], $billName
|
||||
$journal['transaction_journal_id'],
|
||||
$billName
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class MoveDescriptionToNotes implements ActionInterface
|
||||
}
|
||||
$note = $object->notes()->first();
|
||||
if (null === $note) {
|
||||
$note = new Note;
|
||||
$note = new Note();
|
||||
$note->noteable()->associate($object);
|
||||
$note->text = '';
|
||||
}
|
||||
|
||||
@@ -50,13 +50,11 @@ class PrependNotes implements ActionInterface
|
||||
*/
|
||||
public function actOnArray(array $journal): bool
|
||||
{
|
||||
$dbNote = Note
|
||||
::
|
||||
where('noteable_id', (int) $journal['transaction_journal_id'])
|
||||
$dbNote = Note::where('noteable_id', (int) $journal['transaction_journal_id'])
|
||||
->where('noteable_type', TransactionJournal::class)
|
||||
->first(['notes.*']);
|
||||
if (null === $dbNote) {
|
||||
$dbNote = new Note;
|
||||
$dbNote = new Note();
|
||||
$dbNote->noteable_id = (int) $journal['transaction_journal_id'];
|
||||
$dbNote->noteable_type = TransactionJournal::class;
|
||||
$dbNote->text = '';
|
||||
|
||||
@@ -66,5 +66,4 @@ class RemoveAllTags implements ActionInterface
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class RemoveTag implements ActionInterface
|
||||
return false;
|
||||
}
|
||||
$count = DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal['transaction_journal_id'])->where('tag_id', $tag->id)->count();
|
||||
if(0 === $count) {
|
||||
if (0 === $count) {
|
||||
Log::debug(sprintf('RuleAction RemoveTag tried to remove tag "%s" from journal #%d but no such tag is linked.', $name, $journal['transaction_journal_id']));
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,8 @@ class SetBudget implements ActionInterface
|
||||
if (null === $budget) {
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'RuleAction SetBudget could not set budget of journal #%d to "%s" because no such budget exists.', $journal['transaction_journal_id'],
|
||||
'RuleAction SetBudget could not set budget of journal #%d to "%s" because no such budget exists.',
|
||||
$journal['transaction_journal_id'],
|
||||
$search
|
||||
)
|
||||
);
|
||||
|
||||
@@ -67,7 +67,8 @@ class SetCategory implements ActionInterface
|
||||
if (null === $category) {
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'RuleAction SetCategory could not set category of journal #%d to "%s" because no such category exists.', $journal['transaction_journal_id'],
|
||||
'RuleAction SetCategory could not set category of journal #%d to "%s" because no such category exists.',
|
||||
$journal['transaction_journal_id'],
|
||||
$search
|
||||
)
|
||||
);
|
||||
@@ -77,7 +78,9 @@ class SetCategory implements ActionInterface
|
||||
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'RuleAction SetCategory set the category of journal #%d to category #%d ("%s").', $journal['transaction_journal_id'], $category->id,
|
||||
'RuleAction SetCategory set the category of journal #%d to category #%d ("%s").',
|
||||
$journal['transaction_journal_id'],
|
||||
$category->id,
|
||||
$category->name
|
||||
)
|
||||
);
|
||||
|
||||
@@ -75,7 +75,9 @@ class SetDestinationAccount implements ActionInterface
|
||||
if ((TransactionType::DEPOSIT === $type || TransactionType::TRANSFER === $type) && null === $newAccount) {
|
||||
Log::error(
|
||||
sprintf(
|
||||
'Cant change destination account of journal #%d because no asset account with name "%s" exists.', $object->id, $this->action->action_value
|
||||
'Cant change destination account of journal #%d because no asset account with name "%s" exists.',
|
||||
$object->id,
|
||||
$this->action->action_value
|
||||
)
|
||||
);
|
||||
|
||||
@@ -99,7 +101,8 @@ class SetDestinationAccount implements ActionInterface
|
||||
if (null !== $newAccount && (int) $newAccount->id === (int) $source->account_id) {
|
||||
Log::error(
|
||||
sprintf(
|
||||
'New destination account ID #%d and current source account ID #%d are the same. Do nothing.', $newAccount->id,
|
||||
'New destination account ID #%d and current source account ID #%d are the same. Do nothing.',
|
||||
$newAccount->id,
|
||||
$source->account_id
|
||||
)
|
||||
);
|
||||
@@ -126,8 +129,6 @@ class SetDestinationAccount implements ActionInterface
|
||||
Log::debug(sprintf('Updated journal #%d (group #%d) and gave it new destination account ID.', $object->id, $object->transaction_group_id));
|
||||
|
||||
return true;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,6 +168,4 @@ class SetDestinationAccount implements ActionInterface
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class SetNotes implements ActionInterface
|
||||
$dbNote = Note::where('noteable_id', $journal['transaction_journal_id'])
|
||||
->where('noteable_type', TransactionJournal::class)->first();
|
||||
if (null === $dbNote) {
|
||||
$dbNote = new Note;
|
||||
$dbNote = new Note();
|
||||
$dbNote->noteable_id = $journal['transaction_journal_id'];
|
||||
$dbNote->noteable_type = TransactionJournal::class;
|
||||
$dbNote->text = '';
|
||||
@@ -64,7 +64,9 @@ class SetNotes implements ActionInterface
|
||||
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'RuleAction SetNotes changed the notes of journal #%d from "%s" to "%s".', $journal['transaction_journal_id'], $oldNotes,
|
||||
'RuleAction SetNotes changed the notes of journal #%d from "%s" to "%s".',
|
||||
$journal['transaction_journal_id'],
|
||||
$oldNotes,
|
||||
$this->action->action_value
|
||||
)
|
||||
);
|
||||
|
||||
@@ -96,7 +96,8 @@ class SetSourceAccount implements ActionInterface
|
||||
if (null !== $newAccount && (int) $newAccount->id === (int) $destination->account_id) {
|
||||
Log::error(
|
||||
sprintf(
|
||||
'New source account ID #%d and current destination account ID #%d are the same. Do nothing.', $newAccount->id,
|
||||
'New source account ID #%d and current destination account ID #%d are the same. Do nothing.',
|
||||
$newAccount->id,
|
||||
$destination->account_id
|
||||
)
|
||||
);
|
||||
|
||||
@@ -39,7 +39,6 @@ use Log;
|
||||
*/
|
||||
class UpdatePiggybank implements ActionInterface
|
||||
{
|
||||
|
||||
/** @var RuleAction The rule action */
|
||||
private $action;
|
||||
|
||||
@@ -107,7 +106,9 @@ class UpdatePiggybank implements ActionInterface
|
||||
}
|
||||
Log::info(
|
||||
sprintf(
|
||||
'Piggy bank is not linked to source ("#%d") or destination ("#%d"), so no action will be taken.', $source->account_id, $destination->account_id
|
||||
'Piggy bank is not linked to source ("#%d") or destination ("#%d"), so no action will be taken.',
|
||||
$source->account_id,
|
||||
$destination->account_id
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user