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

ProfilerReport::__construct()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
cc 3
eloc 5
nc 4
nop 1
dl 0
loc 9
ccs 0
cts 0
cp 0
crap 12
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