/
ClientBuilderConfigurator.php
36 lines (29 loc) · 1.1 KB
/
ClientBuilderConfigurator.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
namespace Sentry\SentryBundle\DependencyInjection;
use Sentry\ClientBuilderInterface;
use Sentry\Integration\ErrorListenerIntegration;
use Sentry\Integration\ExceptionListenerIntegration;
use Sentry\Integration\IntegrationInterface;
use Sentry\SentryBundle\SentryBundle;
class ClientBuilderConfigurator
{
public static function configure(ClientBuilderInterface $clientBuilder): void
{
$clientBuilder->setSdkIdentifier(SentryBundle::SDK_IDENTIFIER);
$clientBuilder->setSdkVersion(SentryBundle::getSdkVersion());
$options = $clientBuilder->getOptions();
if (! $options->hasDefaultIntegrations()) {
return;
}
$integrations = $options->getIntegrations();
$options->setIntegrations(array_filter($integrations, static function (IntegrationInterface $integration): bool {
if ($integration instanceof ErrorListenerIntegration) {
return false;
}
if ($integration instanceof ExceptionListenerIntegration) {
return false;
}
return true;
}));
}
}