$body =
$request->
toArray();
foreach ([$this->signatureHeaderName,
$this->eventHeaderName,
$this->idHeaderName
] as $header) { if (!
$request->headers->
has($header)) { throw new RejectWebhookException(406,
sprintf('Missing "%s" HTTP request signature header.',
$header));
} } $this->
validateSignature($request->headers,
$request->
getContent(),
$secret);
return new RemoteEvent( $request->headers->
get($this->eventHeaderName
),
$request->headers->
get($this->idHeaderName
),
$body );
} private function validateSignature(HeaderBag
$headers, string
$body,
$secret): void
{ $signature =
$headers->
get($this->signatureHeaderName
);
$event =
$headers->
get($this->eventHeaderName
);
$id =
$headers->
get($this->idHeaderName
);