1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of NodalFlow. |
5
|
|
|
* (c) Fabrice de Stefanis / https://github.com/fab2s/NodalFlow |
6
|
|
|
* This source file is licensed under the MIT license which you will |
7
|
|
|
* find in the LICENSE file or at https://opensource.org/licenses/MIT |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace fab2s\NodalFlow\Callbacks; |
11
|
|
|
|
12
|
|
|
use fab2s\NodalFlow\Flows\FlowInterface; |
13
|
|
|
use fab2s\NodalFlow\Nodes\NodeInterface; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Abstract Class CallbackAbstract |
17
|
|
|
* Provide with dummy implementations to allow partial |
18
|
|
|
* and DRY usage (eg actually use some of the events) |
19
|
|
|
* |
20
|
|
|
* @deprecated use FlowEvent or implement FlowEventInterface instead |
21
|
|
|
*/ |
22
|
|
|
abstract class CallbackAbstract implements CallbackInterface |
|
|
|
|
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* Triggered when a Flow starts |
26
|
|
|
* |
27
|
|
|
* @param FlowInterface $flow |
28
|
|
|
*/ |
29
|
|
|
public function start(FlowInterface $flow) |
30
|
|
|
{ |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Triggered when a Flow progresses, |
35
|
|
|
* eg exec once or generates once |
36
|
|
|
* |
37
|
|
|
* @param FlowInterface $flow |
38
|
|
|
* @param NodeInterface $node |
39
|
|
|
*/ |
40
|
|
|
public function progress(FlowInterface $flow, NodeInterface $node) |
41
|
|
|
{ |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Triggered when a Flow completes without exceptions |
46
|
|
|
* |
47
|
|
|
* @param FlowInterface $flow |
48
|
|
|
*/ |
49
|
|
|
public function success(FlowInterface $flow) |
50
|
|
|
{ |
51
|
|
|
/* |
52
|
|
|
* `if ($flow->getFlowStatus()->isDirty()) { |
53
|
|
|
* // a node broke the flow |
54
|
|
|
* }` |
55
|
|
|
*/ |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Triggered when a Flow fails |
60
|
|
|
* |
61
|
|
|
* @param FlowInterface $flow |
62
|
|
|
*/ |
63
|
|
|
public function fail(FlowInterface $flow) |
64
|
|
|
{ |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|
This interface has been deprecated. The supplier of the interface has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the interface will be removed and what other interface to use instead.