ExtendedCounterReport::extractDataFrom()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 16
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 14
nc 2
nop 1
dl 0
loc 16
ccs 15
cts 15
cp 1
crap 2
rs 9.7998
c 0
b 0
f 0
1
<?php declare(strict_types=1);
2
3
namespace AlecRabbit\Reports;
4
5
use AlecRabbit\Counters\Core\Traits\ExtendedCounterFields;
6
use AlecRabbit\Counters\ExtendedCounter;
7
use AlecRabbit\Reports\Core\AbstractCounterReport;
8
use AlecRabbit\Reports\Core\AbstractReportable;
9
10
/**
11
 * Class ExtendedCounterReport
12
 *
13
 * @psalm-suppress PropertyNotSetInConstructor
14
 */
15
class ExtendedCounterReport extends AbstractCounterReport
16
{
17
    use ExtendedCounterFields;
18
19
    /** {@inheritDoc} */
20 3
    protected function extractDataFrom(AbstractReportable $reportable = null): void
21
    {
22 3
        $this->data = [];
23 3
        if ($reportable instanceof ExtendedCounter) {
24 3
            $this->name = $this->data['name'] = $reportable->getName();
25 3
            $this->value = $this->data['value'] = $reportable->getValue();
26 3
            $this->step = $this->data['step'] = $reportable->getStep();
27 3
            $this->started = $this->data['started'] = $reportable->isStarted();
28 3
            $this->initialValue = $this->data['initialValue'] = $reportable->getInitialValue();
29 3
            $this->bumped = $this->data['bumped'] = $reportable->getBumped();
30 3
            $this->max = $this->data['max'] = $reportable->getMax();
31 3
            $this->min = $this->data['min'] = $reportable->getMin();
32 3
            $this->path = $this->data['path'] = $reportable->getPath();
33 3
            $this->length = $this->data['length'] = $reportable->getLength();
34 3
            $this->diff = $this->data['diff'] = $reportable->getDiff();
35 3
            $this->bumpedBack = $this->data['bumpedBack'] = $reportable->getBumpedBack();
36
        }
37 3
    }
38
}
39