You are here

public function Report::onHandleWebhook in Acquia Content Hub 8.2

Handles webhook events.

Parameters

\Drupal\acquia_contenthub\Event\HandleWebhookEvent $event: The HandleWebhookEvent object.

Throws

\Exception

File

src/EventSubscriber/HandleWebhook/Report.php, line 74

Class

Report
Handles webhooks with a payload requesting site report.

Namespace

Drupal\acquia_contenthub\EventSubscriber\HandleWebhook

Code

public function onHandleWebhook(HandleWebhookEvent $event) : void {
  $payload = $event
    ->getPayload();
  if ('successful' !== $payload['status'] || self::PAYLOAD_REPORT !== $payload['crud']) {
    return;
  }
  $response = $this
    ->getResponse($event, json_encode($this
    ->getReport()));
  $event
    ->setResponse($response);
  $event
    ->stopPropagation();
}