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

ProfilerReport::getCountersReports()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 1
rs 10
c 0
b 0
f 0
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