ByIdFinder   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 17
ccs 6
cts 6
cp 1
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A execute() 0 9 3
1
<?php
2
3
namespace ZoiloMora\ElasticAPM\Processor\MetricSetProcessor;
4
5
use ZoiloMora\ElasticAPM\Events\Event;
6
7
final class ByIdFinder
8
{
9
    /**
10
     * @param string $id
11
     * @param Event[] $events
12
     *
13
     * @return Event|null
14
     */
15 2
    public function execute($id, array $events)
16
    {
17 2
        foreach ($events as $event) {
18 2
            if ($event->id() === $id) {
19 1
                return $event;
20
            }
21 2
        }
22
23 1
        return null;
24
    }
25
}
26