Completed
Push — master ( 6a7da5...1827cf )
by Alec
08:13 queued 02:32
created

TimerFields::isNotStarted()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace AlecRabbit\Tools\Traits;
4
5
use AlecRabbit\Traits\GettableName;
6
7
trait TimerFields
8
{
9
    use GettableName;
10
11
    /** @var float */
12
    protected $previous = 0.0;
13
14
    /** @var float */
15
    protected $creation = 0.0;
16
17
    /** @var float */
18
    protected $elapsed = 0.0;
19
20
    /** @var bool */
21
    protected $stopped = false;
22
23
    /** @var bool */
24
    protected $started = false;
25
26
    /** @var float */
27
    protected $currentValue = 0.0;
28
29
    /** @var float */
30
    protected $avgValue = 0.0;
31
32
    /** @var float */
33
    protected $minValue = 100000000.0;
34
35
    /** @var int */
36
    protected $minValueIteration = 0;
37
38
    /** @var float */
39
    protected $maxValue = 0.0;
40
41
    /** @var int */
42
    protected $maxValueIteration = 0;
43
44
    /** @var int */
45
    protected $count = 0;
46
47
    /**
48
     * @return bool
49
     */
50 12
    public function isStopped(): bool
51
    {
52 12
        return $this->stopped;
53
    }
54
55
    /**
56
     * @return bool
57
     */
58 12
    public function isStarted(): bool
59
    {
60 12
        return $this->started;
61
    }
62
63
    /**
64
     * @return bool
65
     */
66 16
    public function isNotStarted(): bool
67
    {
68 16
        return !$this->started;
69
    }
70
71
    /**
72
     * @return float
73
     */
74 15
    public function getLastValue(): float
75
    {
76 15
        return $this->currentValue;
77
    }
78
79
    /**
80
     * @return float
81
     */
82 15
    public function getAverageValue(): float
83
    {
84 15
        return $this->avgValue;
85
    }
86
87
    /**
88
     * @return float
89
     */
90 15
    public function getMinValue(): float
91
    {
92 15
        return $this->minValue;
93
    }
94
95
    /**
96
     * @return float
97
     */
98 15
    public function getMaxValue(): float
99
    {
100 15
        return $this->maxValue;
101
    }
102
103
    /**
104
     * @return int
105
     */
106 15
    public function getCount(): int
107
    {
108 15
        return $this->count;
109
    }
110
111
    /**
112
     * @return int
113
     */
114 12
    public function getMinValueIteration(): int
115
    {
116 12
        return $this->minValueIteration;
117
    }
118
119
    /**
120
     * @return int
121
     */
122 12
    public function getMaxValueIteration(): int
123
    {
124 12
        return $this->maxValueIteration;
125
    }
126
127
    /**
128
     * @return float
129
     */
130 8
    public function getElapsed(): float
131
    {
132 8
        return $this->elapsed;
133
    }
134
135
    /**
136
     * @return bool
137
     */
138 15
    public function isNotStopped(): bool
139
    {
140 15
        return !$this->stopped;
141
    }
142
143
    /**
144
     * @return float
145
     */
146 12
    public function getCreation(): float
147
    {
148 12
        return $this->creation;
149
    }
150
151
    /**
152
     * @return float
153
     */
154 12
    public function getPrevious(): float
155
    {
156 12
        return $this->previous;
157
    }
158
}
159