ocmDiscoveryService->getIncomingSignedRequest(); } catch (IncomingRequestException $e) { $this->logger->warning('incoming ocm request exception', ['exception' => $e]); return new JSONResponse(['message' => $e->getMessage(), 'validationErrors' => []], Http::STATUS_BAD_REQUEST); } // assuming that ocm request contains a json array $payload = $signedRequest?->getBody() ?? file_get_contents('php://input'); try { $payload = ($payload) ? json_decode($payload, true, 512, JSON_THROW_ON_ERROR) : null; } catch (JsonException $e) { $this->logger->debug('json decode error', ['exception' => $e]); $payload = null; } $event = new OCMEndpointRequestEvent( $this->request->getMethod(), preg_replace('@/+@', '/', $ocmPath), $payload, $signedRequest?->getOrigin() ); $this->eventDispatcher->dispatchTyped($event); return $event->getResponse() ?? new Response(Http::STATUS_NOT_FOUND); } }