|
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\Flows; |
|
11
|
|
|
|
|
12
|
|
|
use fab2s\NodalFlow\Nodes\NodeInterface; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Abstract Class FlowAbstract |
|
16
|
|
|
*/ |
|
17
|
|
|
abstract class FlowAbstract extends FlowInterruptAbstract |
|
18
|
|
|
{ |
|
19
|
|
|
use FlowIdTrait; |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* Get the stats array with latest Node stats |
|
23
|
|
|
* |
|
24
|
|
|
* @return array<string,integer|string> |
|
25
|
|
|
*/ |
|
26
|
|
|
public function getStats() |
|
27
|
|
|
{ |
|
28
|
|
|
return $this->flowMap->getStats(); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Get the stats array with latest Node stats |
|
33
|
|
|
* |
|
34
|
|
|
* @return FlowMapInterface |
|
35
|
|
|
*/ |
|
36
|
|
|
public function getFlowMap() |
|
37
|
|
|
{ |
|
38
|
|
|
return $this->flowMap; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* Get the Node array |
|
43
|
|
|
* |
|
44
|
|
|
* @return NodeInterface[] |
|
45
|
|
|
*/ |
|
46
|
|
|
public function getNodes() |
|
47
|
|
|
{ |
|
48
|
|
|
return $this->nodes; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Get/Generate Node Map |
|
53
|
|
|
* |
|
54
|
|
|
* @return array |
|
55
|
|
|
*/ |
|
56
|
|
|
public function getNodeMap() |
|
57
|
|
|
{ |
|
58
|
|
|
return $this->flowMap->getNodeMap(); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* The Flow status can either indicate be: |
|
63
|
|
|
* - clean (isClean()): everything went well |
|
64
|
|
|
* - dirty (isDirty()): one Node broke the flow |
|
65
|
|
|
* - exception (isException()): an exception was raised during the flow |
|
66
|
|
|
* |
|
67
|
|
|
* @return FlowStatusInterface |
|
68
|
|
|
*/ |
|
69
|
|
|
public function getFlowStatus() |
|
70
|
|
|
{ |
|
71
|
|
|
return $this->flowStatus; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* getId() alias for backward compatibility |
|
76
|
|
|
* |
|
77
|
|
|
* @deprecated use `getId` instead |
|
78
|
|
|
* |
|
79
|
|
|
* @return string |
|
80
|
|
|
*/ |
|
81
|
|
|
public function getFlowId() |
|
82
|
|
|
{ |
|
83
|
|
|
return $this->getId(); |
|
84
|
|
|
} |
|
85
|
|
|
} |
|
86
|
|
|
|