You are here

public function PurgeBase::onHandleWebhook in Acquia Content Hub 8.2

On handle webhook event.

Parameters

\Drupal\acquia_contenthub\Event\HandleWebhookEvent $event: The handle webhook event.

File

src/EventSubscriber/HandleWebhook/PurgeBase.php, line 68

Class

PurgeBase
Class PurgeBase.

Namespace

Drupal\acquia_contenthub\EventSubscriber\HandleWebhook

Code

public function onHandleWebhook(HandleWebhookEvent $event) {
  $payload = $event
    ->getPayload();
  if (self::PURGE !== $payload['crud']) {
    return;
  }
  if ('successful' !== $payload['status']) {
    $this->logger
      ->error('Failed to react on @webhook webhook (@payload).', [
      '@webhook' => self::PURGE,
      '@payload' => print_r($payload, TRUE),
    ]);
    return;
  }
  $this
    ->onPurgeSuccessful();
}