Completed
Push — master ( 6a7da5...1827cf )
by Alec
08:13 queued 02:32
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 12
cts 12
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 getTimersReports() 0 3 1
A __construct() 0 9 3
A getCountersReports() 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 4
    public function getReports(): array
24
    {
25 4
        return $this->reports;
26
    }
27
    
28
    /**
29
     * @return array
30
     */
31 2
    public function getCountersReports(): array
32
    {
33 2
        return $this->reports[self::COUNTERS];
34
    }
35
36
    /**
37
     * @return array
38
     */
39 2
    public function getTimersReports(): array
40
    {
41 2
        return $this->reports[self::TIMERS];
42
    }
43
44
    /**
45
     * ProfilerReport constructor.
46
     * @param Profiler $profiler
47
     */
48 5
    public function __construct(Profiler $profiler)
49
    {
50 5
        foreach ($profiler->getCounters() as $counter) {
51 5
            $this->reports[self::COUNTERS][$counter->getName()] = $counter->getReport();
52
        }
53 5
        foreach ($profiler->getTimers() as $timer) {
54 5
            $this->reports[self::TIMERS][$timer->getName()] = $timer->getReport();
55
        }
56 5
        parent::__construct();
57 5
    }
58
}
59