You are here

public function RemoveExceptionFrameVarsIntegration::setupOnce in Raven: Sentry Integration 3.x

File

src/Integration/RemoveExceptionFrameVarsIntegration.php, line 21

Class

RemoveExceptionFrameVarsIntegration
Removes function calling arguments from exception stack frames.

Namespace

Drupal\raven\Integration

Code

public function setupOnce() : void {
  Scope::addGlobalEventProcessor(function (Event $event) : Event {
    $currentHub = SentrySdk::getCurrentHub();
    $integration = $currentHub
      ->getIntegration(self::class);
    $client = $currentHub
      ->getClient();

    // The client bound to the current hub, if any, could not have this
    // integration enabled. If this is the case, bail out.
    if (NULL === $integration || NULL === $client) {
      return $event;
    }
    $this
      ->processEvent($event, $client
      ->getOptions());
    return $event;
  });
}