SentryIntegration::captureException()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 2
nc 2
nop 1
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