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

CounterReport::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

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