InfluxDBFormatter::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Umbrellio\TableSync\Monolog\Formatter;
6
7
use InfluxDB\Point;
8
9
class InfluxDBFormatter extends TableSyncFormatter
10
{
11
    private $measurement;
12
13 1
    public function __construct(string $measurement)
14
    {
15 1
        parent::__construct();
16
17 1
        $this->measurement = $measurement;
18
    }
19
20 1
    public function format(array $record): array
21
    {
22 1
        return [
23 1
            new Point(
24 1
                $this->measurement,
25 1
                count($this->getAttributes($record)),
26 1
                [
27 1
                    'model' => $this->getModel($record),
28 1
                    'event' => $this->getEventType($record),
29 1
                    'direction' => $this->getDirection($record),
30 1
                ]
31 1
            ),
32 1
        ];
33
    }
34
}
35