Skip to content

Commit

Permalink
fix: feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
wthijmen authored and myparcel-bot[bot] committed Oct 27, 2023
1 parent d38424d commit 77ed6f1
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/App/Webhook/PdkWebhookManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ private function getHooks(Request $request): array
$headers = $request->headers->all();
$body = json_decode($request->getContent(), true);

if (isset($headers['x-myparcel-hook'])) {
$body['data']['hooks'] = array_map(function ($hook) use ($headers) {
$hook['event'] = $headers['x-myparcel-hook'][0];

return $hook;
}, $body['data']['hooks']);
if (! isset($headers['x-myparcel-hook'])) {
return $body['data']['hooks'] ?? [];

Check warning on line 124 in src/App/Webhook/PdkWebhookManager.php

View check run for this annotation

Codecov / codecov/patch

src/App/Webhook/PdkWebhookManager.php#L124

Added line #L124 was not covered by tests
}

return $body['data']['hooks'] ?? [];
return array_map(static function ($hook) use ($headers) {
$hook['event'] = $headers['x-myparcel-hook'][0];

return $hook;
}, $body['data']['hooks']);
}
}

0 comments on commit 77ed6f1

Please sign in to comment.