Completed
Push — develop ( f10e50...4f888d )
by Alec
03:20
created

CounterReport   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 26
ccs 11
cts 11
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A __toString() 0 8 1
1
<?php
2
/**
3
 * User: alec
4
 * Date: 29.11.18
5
 * Time: 21:02
6
 */
7
8
namespace AlecRabbit\Tools\Reports;
9
10
use AlecRabbit\Tools\Counter;
11
use AlecRabbit\Tools\Reports\Base\Report;
12
use AlecRabbit\Tools\Traits\CounterFields;
13
14
class CounterReport extends Report
15
{
16
    use CounterFields;
17
18
    /**
19
     * CounterReport constructor.
20
     * @param Counter $counter
21
     */
22 6
    public function __construct(Counter $counter)
23
    {
24 6
        $this->name = $counter->getName();
25 6
        $this->value = $counter->getValue();
26 6
        $this->step = $counter->getStep();
27 6
    }
28
29
    /**
30
     * @return string
31
     */
32 1
    public function __toString(): string
33
    {
34
        return
35 1
            sprintf(
36 1
                'Counter:[%s] Value: %s, Step: %s' . PHP_EOL,
37 1
                $this->getName(),
38 1
                $this->getValue(),
39 1
                $this->getStep()
40
            );
41
    }
42
}
43