2020-08-22 05:24:01 -05:00
|
|
|
<?php
|
2021-01-29 11:50:35 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* RuleEngineInterface.php
|
|
|
|
* Copyright (c) 2021 james@firefly-iii.org
|
|
|
|
*
|
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2020-09-18 05:16:47 -05:00
|
|
|
declare(strict_types=1);
|
2020-08-22 05:24:01 -05:00
|
|
|
/*
|
|
|
|
* RuleEngineInterface.php
|
|
|
|
* Copyright (c) 2020 james@firefly-iii.org
|
|
|
|
*
|
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as
|
|
|
|
* published by the Free Software Foundation, either version 3 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace FireflyIII\TransactionRules\Engine;
|
|
|
|
|
2020-08-22 09:55:54 -05:00
|
|
|
use FireflyIII\User;
|
2020-08-22 05:24:01 -05:00
|
|
|
use Illuminate\Support\Collection;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface RuleEngineInterface
|
|
|
|
*/
|
|
|
|
interface RuleEngineInterface
|
|
|
|
{
|
2020-08-22 09:55:54 -05:00
|
|
|
/**
|
|
|
|
* @param User $user
|
|
|
|
*/
|
|
|
|
public function setUser(User $user): void;
|
2020-08-22 06:01:37 -05:00
|
|
|
/**
|
|
|
|
* Add rules for the engine to execute.
|
|
|
|
*
|
|
|
|
* @param Collection $rules
|
|
|
|
*/
|
2020-08-22 05:24:01 -05:00
|
|
|
public function setRules(Collection $rules): void;
|
|
|
|
|
2020-08-22 06:01:37 -05:00
|
|
|
/**
|
|
|
|
* Add entire rule groups for the engine to execute.
|
|
|
|
*
|
|
|
|
* @param Collection $ruleGroups
|
|
|
|
*/
|
2020-08-22 05:24:01 -05:00
|
|
|
public function setRuleGroups(Collection $ruleGroups): void;
|
|
|
|
|
2020-08-22 06:01:37 -05:00
|
|
|
/**
|
|
|
|
* Add operators added to each search by the rule engine.
|
|
|
|
*
|
|
|
|
* @param array $operator
|
|
|
|
*/
|
|
|
|
public function addOperator(array $operator): void;
|
|
|
|
|
2020-08-22 09:55:54 -05:00
|
|
|
/**
|
|
|
|
* Fire the rule engine.
|
|
|
|
*/
|
|
|
|
public function fire(): void;
|
|
|
|
|
2020-08-24 00:31:50 -05:00
|
|
|
/**
|
|
|
|
* Find all transactions only, dont apply anything.
|
|
|
|
*/
|
|
|
|
public function find(): Collection;
|
|
|
|
|
2020-12-21 22:35:06 -06:00
|
|
|
}
|