ScanQueryResponse::data()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 9
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Level23\Druid\Responses;
5
6
class ScanQueryResponse extends QueryResponse
7
{
8
    /**
9
     * Return the data in a "normalized" way, so we can easily iterate over it
10
     *
11
     * @return array<int,string|int|array<mixed>>
12
     */
13 2
    public function data(): array
14
    {
15 2
        $result = [];
16 2
        array_walk($this->response, function ($row) use (&$result) {
17
            /** @var array<string,array<string|int|array<mixed>>> $row */
18 2
            array_push($result, ...$row['events']);
19 2
        });
20
21 2
        return $result;
22
    }
23
}