State   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 68
ccs 14
cts 14
cp 1
rs 10
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A isNormal() 0 3 1
A getType() 0 3 1
A __construct() 0 4 1
A isInitial() 0 3 1
A isFinal() 0 3 1
A getName() 0 3 1
1
<?php
2
/**
3
 * @author: RunnerLee
4
 * @email: [email protected]
5
 * @time: 2018-02
6
 */
7
8
namespace Runner\Heshen;
9
10
class State
11
{
12
    const TYPE_INITIAL = 'initial';
13
14
    const TYPE_NORMAL = 'normal';
15
16
    const TYPE_FINAL = 'final';
17
18
    /**
19
     * @var string
20
     */
21
    protected $name;
22
23
    /**
24
     * @var string
25
     */
26
    protected $type;
27
28
    /**
29
     * State constructor.
30
     *
31
     * @param string $name
32
     * @param string $type
33
     */
34 16
    public function __construct($name, $type)
35
    {
36 16
        $this->name = $name;
37 16
        $this->type = $type;
38 16
    }
39
40
    /**
41
     * @return string
42
     */
43 6
    public function getName(): string
44
    {
45 6
        return $this->name;
46
    }
47
48
    /**
49
     * @return string
50
     */
51 1
    public function getType(): string
52
    {
53 1
        return $this->type;
54
    }
55
56
    /**
57
     * @return bool
58
     */
59 4
    public function isInitial(): bool
60
    {
61 4
        return self::TYPE_INITIAL === $this->type;
62
    }
63
64
    /**
65
     * @return bool
66
     */
67 4
    public function isNormal(): bool
68
    {
69 4
        return self::TYPE_NORMAL === $this->type;
70
    }
71
72
    /**
73
     * @return bool
74
     */
75 3
    public function isFinal(): bool
76
    {
77 3
        return self::TYPE_FINAL === $this->type;
78
    }
79
}
80