SentryIntegration::bound()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Zing\LaravelSentry\Support;
6
7
use Illuminate\Container\Container;
8
use Sentry\Laravel\ServiceProvider;
9
use Sentry\State\Hub;
10
11
class SentryIntegration
12
{
13
    public static function getAbstract(): string
14
    {
15
        return class_exists(ServiceProvider::class) ? ServiceProvider::$abstract : 'sentry';
16
    }
17
18
    public static function bound(): bool
19
    {
20
        return Container::getInstance()->bound(static::getAbstract());
21
    }
22
23
    public static function captureException($exception): void
24
    {
25
        if (static::bound()) {
26
            static::getInstance()->captureException($exception);
27
        }
28
    }
29
30
    public static function getInstance(): Hub
31
    {
32
        return Container::getInstance()->make(static::getAbstract());
33
    }
34
}
35