public function handle(string
$type, Request
$request): Response
{ if (!
isset($this->parsers
[$type])) { return new Response(sprintf('No parser found for webhook of type "%s".',
$type), 404
);
} /** @var RequestParserInterface $parser */
$parser =
$this->parsers
[$type]['parser'
];
if (!
$event =
$parser->
parse($request,
$this->parsers
[$type]['secret'
])) { return $parser->
createRejectedResponse('Unable to parse the webhook payload.'
);
} $this->bus->
dispatch(new ConsumeRemoteEventMessage($type,
$event));
return $parser->
createSuccessfulResponse();
}}