SentryService   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 9
c 1
b 0
f 0
dl 0
loc 21
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getIssueUrl() 0 6 1
A captureException() 0 2 1
A __construct() 0 4 1
1
<?php
2
3
namespace Skater4\LaravelSentryNotifications\Services\Sentry;
4
5
use Sentry\State\Hub;
6
use Skater4\LaravelSentryNotifications\Services\Sentry\Interfaces\SentryServiceInterface;
7
use Throwable;
8
9
class SentryService implements SentryServiceInterface
10
{
11
    private $sentry;
12
    private $issuesUrl;
13
14
    public function __construct(Hub $sentry, string $issuesUrl)
15
    {
16
        $this->sentry = $sentry;
17
        $this->issuesUrl = rtrim($issuesUrl, '/') . '/';
18
    }
19
20
    public function captureException(Throwable $e): ?string {
21
        return $this->sentry->captureException($e);
22
    }
23
24
    public function getIssueUrl(string $eventId): string {
25
        $data = [
26
            'query' => 'id:' . $eventId
27
        ];
28
29
        return $this->issuesUrl . '?' . http_build_query($data);
30
    }
31
}
32