Skip to content

Commit

Permalink
switch to array_map()
Browse files Browse the repository at this point in the history
  • Loading branch information
iamacarpet committed Apr 16, 2024
1 parent a33c845 commit b46696c
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/AffordableMobiles/OpenTelemetry/CloudTrace/Exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public function shutdown(?CancellationInterface $cancellation = null): bool
* so that the metadata isn't overwritten by the Trace object.
*/
$result->setSpans(
$this->iterable_map(
$this->batch,
array_map(
fn (SpanDataInterface $span): GoogleSpan => $this->converter->convertSpan($span),
$this->batch,
),
);

Expand All @@ -77,15 +77,4 @@ public function forceFlush(?CancellationInterface $cancellation = null): bool
{
return true;
}

private function iterable_map(iterable $batch, callable $fn): array
{
$result = [];

foreach ($batch as $item) {
$result[] = $fn($item);
}

return $result;
}
}

0 comments on commit b46696c

Please sign in to comment.