SectionStateMachine::theCurrentStateIsDetail()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * @author stev leibelt <[email protected]>
4
 * @since 2017-02-01
5
 */
6
namespace Net\Bazzline\Component\ApacheServerStatusParser\Service\StateMachine;
7
8
class SectionStateMachine
9
{
10
    const STATE_OF_DETAIL       = 'detail';
11
    const STATE_OF_INFORMATION  = 'information';
12
    const STATE_OF_SCOREBOARD   = 'scoreboard';
13
    const STATE_OF_STATISTIC    = 'statistic';
14
15
    /** @var string */
16
    private $currentState;
17
18
    public function __construct()
19
    {
20
        $this->reset();
21
    }
22
23
    public function reset()
24
    {
25
        $this->setCurrentStateToInformation();
26
    }
27
28
    public function setCurrentStateToDetail()
29
    {
30
        $this->currentState = self::STATE_OF_DETAIL;
31
    }
32
33
    public function setCurrentStateToInformation()
34
    {
35
        $this->currentState = self::STATE_OF_INFORMATION;
36
    }
37
38
    public function setCurrentStateToScoreboard()
39
    {
40
        $this->currentState = self::STATE_OF_SCOREBOARD;
41
    }
42
43
    public function setCurrentStateToStatistic()
44
    {
45
        $this->currentState = self::STATE_OF_STATISTIC;
46
    }
47
48
    /**
49
     * @return bool
50
     */
51
    public function theCurrentStateIsDetail()
52
    {
53
        return ($this->currentState === self::STATE_OF_DETAIL);
54
    }
55
56
    /**
57
     * @return bool
58
     */
59
    public function theCurrentStateIsInformation()
60
    {
61
        return ($this->currentState === self::STATE_OF_INFORMATION);
62
    }
63
64
    /**
65
     * @return bool
66
     */
67
    public function theCurrentStateIsScoreboard()
68
    {
69
        return ($this->currentState === self::STATE_OF_SCOREBOARD);
70
    }
71
72
    /**
73
     * @return bool
74
     */
75
    public function theCurrentStateIsStatistic()
76
    {
77
        return ($this->currentState === self::STATE_OF_STATISTIC);
78
    }
79
}