Passed
Push — master ( a2b1bc...228ac7 )
by Alec
03:07
created

SimpleCounterReport::createFormatter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace AlecRabbit\Reports;
4
5
use AlecRabbit\Counters\SimpleCounter;
6
use AlecRabbit\Reports\Core\AbstractCounterReport;
7
use AlecRabbit\Reports\Core\AbstractReportable;
8
9
class SimpleCounterReport extends AbstractCounterReport
10
{
11
    /** {@inheritDoc} */
12 6
    protected function extractDataFrom(AbstractReportable $reportable = null): void
13
    {
14 6
        $this->data = [];
15 6
        if ($reportable instanceof SimpleCounter) {
16 6
            $this->data['name'] = $reportable->getName();
17 6
            $this->data['value'] = $reportable->getValue();
18 6
            $this->data['step'] = $reportable->getStep();
19 6
            $this->data['started'] = $reportable->isStarted();
20 6
            $this->data['initialValue'] = $reportable->getInitialValue();
21 6
            $this->data['bumped'] = $reportable->getBumped();
22
        }
23 6
    }
24
}
25