SimpleCounterReport   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 9
c 3
b 0
f 0
dl 0
loc 13
ccs 9
cts 9
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A extractDataFrom() 0 10 2
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
/**
10
 * Class SimpleCounterReport
11
 *
12
 * @psalm-suppress PropertyNotSetInConstructor
13
 */
14
class SimpleCounterReport extends AbstractCounterReport
15
{
16
    /** {@inheritDoc} */
17 4
    protected function extractDataFrom(AbstractReportable $reportable = null): void
18
    {
19 4
        $this->data = [];
20 4
        if ($reportable instanceof SimpleCounter) {
21 4
            $this->name = $this->data['name'] = $reportable->getName();
22 4
            $this->value = $this->data['value'] = $reportable->getValue();
23 4
            $this->step = $this->data['step'] = $reportable->getStep();
24 4
            $this->started = $this->data['started'] = $reportable->isStarted();
25 4
            $this->initialValue = $this->data['initialValue'] = $reportable->getInitialValue();
26 4
            $this->bumped = $this->data['bumped'] = $reportable->getBumped();
27
        }
28 4
    }
29
}
30