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

ProfilerReport   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 42
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getReports() 0 3 1
A __construct() 0 9 3
A getCountersReports() 0 3 1
A getTimersReports() 0 3 1
1
<?php
2
/**
3
 * User: alec
4
 * Date: 01.12.18
5
 * Time: 17:36
6
 */
7
8
namespace AlecRabbit\Tools\Reports;
9
10
use AlecRabbit\Exception\InvalidStyleException;
11
use AlecRabbit\Tools\Contracts\StringsInterface;
12
use AlecRabbit\Tools\Profiler;
13
use AlecRabbit\Tools\Reports\Base\Report;
14
15
class ProfilerReport extends Report implements StringsInterface
16
{
17
    /** @var array */
18
    private $reports = [];
19
20
    /**
21
     * @return array
22
     */
23 5
    public function getReports(): array
24
    {
25 5
        return $this->reports;
26
    }
27
    
28
    /**
29
     * @return array
30
     */
31
    public function getCountersReports(): array
32
    {
33 7
        return $this->reports[self::_COUNTERS];
34
    }
35 7
36 7
    /**
37
     * @return array
38 7
     */
39 7
    public function getTimersReports(): array
40
    {
41 7
        return $this->reports[self::_TIMERS];
42 7
    }
43
44
    /**
45
     * ProfilerReport constructor.
46
     * @param Profiler $profiler
47
     */
48
    public function __construct(Profiler $profiler)
49
    {
50
        foreach ($profiler->getCounters() as $counter) {
51
            $this->reports[self::_COUNTERS][$counter->getName()] = $counter->getReport();
52
        }
53
        foreach ($profiler->getTimers() as $timer) {
54
            $this->reports[self::_TIMERS][$timer->getName()] = $timer->getReport();
55
        }
56
        parent::__construct();
57
    }
58
}
59