NDJson   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 22
ccs 8
cts 8
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A contentType() 0 3 1
A convert() 0 8 1
1
<?php
2
3
namespace ZoiloMora\ElasticAPM\Helper;
4
5
final class NDJson
6
{
7
    /**
8
     * @return string
9
     */
10 1
    public static function contentType()
11
    {
12 1
        return 'application/x-ndjson';
13
    }
14
15
    /**
16
     * @param array $events
17
     * @return string
18
     */
19 1
    public static function convert(array $events)
20
    {
21 1
        return array_reduce(
22 1
            $events,
23 1
            static function ($carry, $item) {
24 1
                $carry .= json_encode($item) . PHP_EOL;
25
26 1
                return $carry;
27
            }
28 1
        );
29
    }
30
}
31