firefly-iii/app/TransactionRules/Engine/RuleEngineInterface.php

68 lines
1.8 KiB
PHP
Raw Normal View History

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
namespace FireflyIII\TransactionRules\Engine;
use FireflyIII\User;
2020-08-22 05:24:01 -05:00
use Illuminate\Support\Collection;
/**
* Interface RuleEngineInterface
*/
interface RuleEngineInterface
{
/**
2021-03-21 03:15:40 -05:00
* Add operators added to each search by the rule engine.
*/
2021-03-21 03:15:40 -05:00
public function addOperator(array $operator): void;
2021-02-08 08:12:04 -06:00
2020-08-22 06:01:37 -05:00
/**
2021-03-21 03:15:40 -05:00
* Find all transactions only, dont apply anything.
2020-08-22 06:01:37 -05:00
*/
2021-03-21 03:15:40 -05:00
public function find(): Collection;
2020-08-22 05:24:01 -05:00
2020-08-22 06:01:37 -05:00
/**
2021-03-21 03:15:40 -05:00
* Fire the rule engine.
2020-08-22 06:01:37 -05:00
*/
2021-03-21 03:15:40 -05:00
public function fire(): void;
2020-08-22 05:24:01 -05:00
2020-08-22 06:01:37 -05:00
/**
2021-03-21 03:15:40 -05:00
* Return the number of changed transactions from the previous "fire" action.
2020-08-22 06:01:37 -05:00
*/
2021-03-21 03:15:40 -05:00
public function getResults(): int;
2020-08-22 06:01:37 -05:00
2023-05-29 06:56:55 -05:00
public function setRefreshTriggers(bool $refreshTriggers): void;
/**
2021-03-21 03:15:40 -05:00
* Add entire rule groups for the engine to execute.
*/
2021-03-21 03:15:40 -05:00
public function setRuleGroups(Collection $ruleGroups): void;
2020-08-24 00:31:50 -05:00
/**
2021-03-21 03:15:40 -05:00
* Add rules for the engine to execute.
2020-08-24 00:31:50 -05:00
*/
2021-03-21 03:15:40 -05:00
public function setRules(Collection $rules): void;
2020-08-24 00:31:50 -05:00
2021-03-21 03:15:40 -05:00
public function setUser(User $user): void;
2020-12-21 22:35:06 -06:00
}