FlowAbstract::getStats()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

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