ByParentIdFinder::execute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 7
ccs 6
cts 6
cp 1
crap 1
rs 10
1
<?php
2
3
namespace ZoiloMora\ElasticAPM\Processor\MetricSetProcessor;
4
5
use ZoiloMora\ElasticAPM\Events\Event;
6
use ZoiloMora\ElasticAPM\Events\TraceableEvent;
7
8
final class ByParentIdFinder
9
{
10
    /**
11
     * @param string $parentId
12
     * @param Event[] $events
13
     *
14
     * @return Event[]
15
     */
16 1
    public function execute($parentId, array $events)
17
    {
18 1
        return array_values(
19 1
            array_filter(
20 1
                $events,
21 1
                static function (TraceableEvent $event) use ($parentId) {
22 1
                    return $event->parentId() === $parentId;
23
                }
24 1
            )
25 1
        );
26
    }
27
}
28