InfluxDBFormatter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 11
c 1
b 0
f 0
dl 0
loc 21
ccs 12
cts 12
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A format() 0 10 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