Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | // This file is part of Moodle - https://moodle.org/ |
| 3 | // |
| 4 | // Moodle is free software: you can redistribute it and/or modify |
| 5 | // it under the terms of the GNU General Public License as published by |
| 6 | // the Free Software Foundation, either version 3 of the License, or |
| 7 | // (at your option) any later version. |
| 8 | // |
| 9 | // Moodle is distributed in the hope that it will be useful, |
| 10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | // GNU General Public License for more details. |
| 13 | // |
| 14 | // You should have received a copy of the GNU General Public License |
| 15 | // along with Moodle. If not, see <https://www.gnu.org/licenses/>. |
| 16 | |
| 17 | declare(strict_types=1); |
| 18 | |
| 19 | namespace tool_autoflow\local\engine; |
| 20 | |
| 21 | /** |
| 22 | * One kind of node in a workflow, such as a condition or "send a notification". |
| 23 | * |
| 24 | * Nodes get their parameters already resolved from placeholders, and the run |
| 25 | * context (trigger data, earlier node outputs, variables) as read-only data. |
| 26 | * |
| 27 | * @package tool_autoflow |
| 28 | * @copyright 2026 DevLMS <contact@devlms.com> |
| 29 | * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
| 30 | */ |
| 31 | interface node_type { |
| 32 | /** |
| 33 | * The type name stored in the graph, such as logic.condition. |
| 34 | * |
| 35 | * @return string |
| 36 | */ |
| 37 | public function type(): string; |
| 38 | |
| 39 | /** |
| 40 | * The parameters the node takes, in display order. |
| 41 | * |
| 42 | * @return param[] |
| 43 | */ |
| 44 | public function params(): array; |
| 45 | |
| 46 | /** |
| 47 | * Named branches the node can choose, such as true and false. Empty for nodes |
| 48 | * that always continue on their plain edges. |
| 49 | * |
| 50 | * @return string[] |
| 51 | */ |
| 52 | public function branches(): array; |
| 53 | |
| 54 | /** |
| 55 | * Run the node. |
| 56 | * |
| 57 | * @param array $params Node parameters with placeholders resolved. |
| 58 | * @param array $context The run context. |
| 59 | * @return node_result |
| 60 | * @throws node_failed When the node cannot do its job; the run stops. |
| 61 | */ |
| 62 | public function execute(array $params, array $context): node_result; |
| 63 | } |