Test Failed
Push — develop ( f741b1...4c7784 )
by Alec
05:40
created

BenchmarkFields   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 84
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0
wmc 8

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getTimer() 0 3 1
A getExceptions() 0 3 1
A getDoneIterations() 0 3 1
A getProfiler() 0 3 1
A resetFields() 0 7 1
A isWithResults() 0 3 1
A getExceptionMessages() 0 3 1
A getFunctions() 0 3 1
1
<?php
2
/**
3
 * User: alec
4
 * Date: 01.12.18
5
 * Time: 20:33
6
 */
7
8
namespace AlecRabbit\Tools\Traits;
9
10
use AlecRabbit\Tools\Profiler;
11
use AlecRabbit\Tools\Timer;
12
13
trait BenchmarkFields
14
{
15
    /** @var array */
16
    protected $functions = [];
17
    /** @var Profiler */
18
    protected $profiler;
19
    /** @var int */
20
    protected $doneIterations = 0;
21
    /** @var bool */
22
    protected $withResults = false;
23
    /** @var array */
24
    private $exceptionMessages = [];
25
    /** @var array */
26
    private $exceptions = [];
27
    /** @var Timer */
28
    private $timer;
29
30 5
31
    /**
32 5
     * Resets fields
33 5
     */
34 5
    protected function resetFields(): void
35 5
    {
36 5
        $this->functions = [];
37 5
        $this->profiler = new Profiler();
38
        $this->withResults = false;
39
        $this->exceptionMessages = [];
40
        $this->exceptions = [];
41
    }
42 4
43
    /**
44 4
     * @return array
45
     */
46
    public function getFunctions(): array
47
    {
48
        return $this->functions;
49
    }
50 4
51
    /**
52 4
     * @return Profiler
53
     */
54
    public function getProfiler(): Profiler
55
    {
56
        return $this->profiler;
57
    }
58 4
59
    /**
60 4
     * @return int
61
     */
62
    public function getDoneIterations(): int
63
    {
64
        return $this->doneIterations;
65
    }
66 4
67
    /**
68 4
     * @return bool
69
     */
70
    public function isWithResults(): bool
71
    {
72
        return $this->withResults;
73
    }
74 4
75
    /**
76 4
     * @return array
77
     */
78
    public function getExceptionMessages(): array
79
    {
80
        return $this->exceptionMessages;
81
    }
82 4
83
    /**
84 4
     * @return array
85
     */
86
    public function getExceptions(): array
87
    {
88
        return $this->exceptions;
89
    }
90
91
    /**
92
     * @return Timer
93
     */
94
    public function getTimer(): Timer
95
    {
96
        return $this->timer;
97
    }
98
}
99