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

SimpleCounterReport::extractDataFrom()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 8
nc 2
nop 1
dl 0
loc 10
ccs 9
cts 9
cp 1
crap 2
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