JsonTableSyncFormatter::format()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 14
ccs 12
cts 12
cp 1
rs 9.9332
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 Monolog\Utils;
8
9
class JsonTableSyncFormatter extends TableSyncFormatter
10
{
11 1
    public function format(array $record)
12
    {
13 1
        $record = parent::format($record);
14 1
        $formatted = [
15 1
            'datetime' => $record['datetime'],
16 1
            'message' => $record['message'],
17 1
            'direction' => $record['direction'],
18 1
            'routing' => $record['routing'],
19 1
            'model' => $record['model'],
20 1
            'event' => $record['event'],
21 1
            'count' => count($record['attributes']),
22 1
        ];
23
24 1
        return Utils::jsonEncode($formatted, Utils::DEFAULT_JSON_FLAGS, true) . "\n";
25
    }
26
}
27