mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Update more code.
This commit is contained in:
@@ -36,14 +36,11 @@ use Illuminate\Support\Facades\DB;
|
||||
*/
|
||||
class AddTag implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -37,14 +37,11 @@ class AppendDescription implements ActionInterface
|
||||
{
|
||||
use RefreshNotesTrait;
|
||||
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -39,14 +39,11 @@ class AppendDescriptionToNotes implements ActionInterface
|
||||
{
|
||||
use RefreshNotesTrait;
|
||||
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -37,14 +37,11 @@ class AppendNotes implements ActionInterface
|
||||
{
|
||||
use RefreshNotesTrait;
|
||||
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -41,14 +41,11 @@ class AppendNotesToDescription implements ActionInterface
|
||||
use ConvertsDataTypes;
|
||||
use RefreshNotesTrait;
|
||||
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -34,14 +34,11 @@ use Illuminate\Support\Facades\DB;
|
||||
*/
|
||||
class ClearBudget implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -34,14 +34,11 @@ use Illuminate\Support\Facades\DB;
|
||||
*/
|
||||
class ClearCategory implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -35,14 +35,11 @@ use Illuminate\Support\Facades\DB;
|
||||
*/
|
||||
class ClearNotes implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -43,14 +43,11 @@ use Illuminate\Support\Facades\DB;
|
||||
*/
|
||||
class ConvertToDeposit implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -42,14 +42,11 @@ use Illuminate\Support\Facades\DB;
|
||||
*/
|
||||
class ConvertToTransfer implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -43,14 +43,11 @@ use Illuminate\Support\Facades\DB;
|
||||
*/
|
||||
class ConvertToWithdrawal implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -35,14 +35,11 @@ use FireflyIII\Services\Internal\Destroy\TransactionGroupDestroyService;
|
||||
*/
|
||||
class DeleteTransaction implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -37,14 +37,11 @@ use Illuminate\Support\Facades\DB;
|
||||
*/
|
||||
class LinkToBill implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -36,14 +36,11 @@ use FireflyIII\Models\TransactionJournal;
|
||||
*/
|
||||
class MoveDescriptionToNotes implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -42,14 +42,11 @@ class MoveNotesToDescription implements ActionInterface
|
||||
{
|
||||
use ConvertsDataTypes;
|
||||
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -34,14 +34,11 @@ use Illuminate\Support\Facades\DB;
|
||||
*/
|
||||
class PrependDescription implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -34,14 +34,11 @@ use FireflyIII\Models\TransactionJournal;
|
||||
*/
|
||||
class PrependNotes implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -34,14 +34,11 @@ use Illuminate\Support\Facades\DB;
|
||||
*/
|
||||
class RemoveAllTags implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -35,14 +35,11 @@ use Illuminate\Support\Facades\DB;
|
||||
*/
|
||||
class RemoveTag implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -35,14 +35,11 @@ class SetAmount implements ActionInterface
|
||||
{
|
||||
use RefreshNotesTrait;
|
||||
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -36,14 +36,11 @@ use Illuminate\Support\Facades\DB;
|
||||
*/
|
||||
class SetBudget implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -36,14 +36,11 @@ use Illuminate\Support\Facades\DB;
|
||||
*/
|
||||
class SetCategory implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -36,14 +36,11 @@ class SetDescription implements ActionInterface
|
||||
{
|
||||
use RefreshNotesTrait;
|
||||
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -39,15 +39,13 @@ use Illuminate\Support\Facades\DB;
|
||||
*/
|
||||
class SetDestinationAccount implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
private AccountRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -39,14 +39,11 @@ use Illuminate\Support\Facades\DB;
|
||||
*/
|
||||
class SetDestinationToCashAccount implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -33,14 +33,11 @@ use FireflyIII\Models\TransactionJournal;
|
||||
*/
|
||||
class SetNotes implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -39,15 +39,13 @@ use Illuminate\Support\Facades\DB;
|
||||
*/
|
||||
class SetSourceAccount implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
private AccountRepositoryInterface $repository;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -39,14 +39,11 @@ use Illuminate\Support\Facades\DB;
|
||||
*/
|
||||
class SetSourceToCashAccount implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -36,14 +36,11 @@ use FireflyIII\Models\TransactionJournal;
|
||||
*/
|
||||
class SwitchAccounts implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -37,14 +37,11 @@ use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpdatePiggyBank implements ActionInterface
|
||||
{
|
||||
private RuleAction $action;
|
||||
|
||||
/**
|
||||
* TriggerInterface constructor.
|
||||
*/
|
||||
public function __construct(RuleAction $action)
|
||||
public function __construct(private readonly RuleAction $action)
|
||||
{
|
||||
$this->action = $action;
|
||||
}
|
||||
|
||||
public function actOnArray(array $journal): bool
|
||||
|
@@ -44,11 +44,11 @@ use Illuminate\Support\Facades\Log;
|
||||
*/
|
||||
class SearchRuleEngine implements RuleEngineInterface
|
||||
{
|
||||
private Collection $groups;
|
||||
private readonly Collection $groups;
|
||||
private array $operators;
|
||||
private bool $refreshTriggers;
|
||||
private array $resultCount;
|
||||
private Collection $rules;
|
||||
private readonly Collection $rules;
|
||||
private User $user;
|
||||
|
||||
public function __construct()
|
||||
|
@@ -82,17 +82,15 @@ class ActionExpression
|
||||
// 'destination_transaction_id',
|
||||
'notes',
|
||||
];
|
||||
private string $expr;
|
||||
private ExpressionLanguage $expressionLanguage;
|
||||
private bool $isExpression;
|
||||
private ?SyntaxError $validationError;
|
||||
private readonly ExpressionLanguage $expressionLanguage;
|
||||
private readonly bool $isExpression;
|
||||
private readonly ?SyntaxError $validationError;
|
||||
|
||||
public function __construct(string $expr)
|
||||
public function __construct(private readonly string $expr)
|
||||
{
|
||||
$this->expressionLanguage = app(ExpressionLanguage::class);
|
||||
$this->expr = $expr;
|
||||
|
||||
$this->isExpression = self::isExpression($expr);
|
||||
$this->isExpression = self::isExpression($this->expr);
|
||||
$this->validationError = $this->validate();
|
||||
}
|
||||
|
||||
|
@@ -45,16 +45,12 @@ class ActionExpressionLanguageProvider implements ExpressionFunctionProviderInte
|
||||
return [
|
||||
new ExpressionFunction(
|
||||
'constant2',
|
||||
static function ($str): string {
|
||||
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'!');
|
||||
},
|
||||
static fn($str): string => sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'!'),
|
||||
$function
|
||||
),
|
||||
new ExpressionFunction(
|
||||
'constant',
|
||||
static function ($str): string {
|
||||
return sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'!');
|
||||
},
|
||||
static fn($str): string => sprintf('(is_string(%1$s) ? strtolower(%1$s) : %1$s)', $str.'!'),
|
||||
$function
|
||||
),
|
||||
|
||||
|
Reference in New Issue
Block a user