GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

SendEventToAnalytics::handle()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 5
c 1
b 0
f 0
nc 4
nop 1
dl 0
loc 11
rs 10
1
<?php
2
3
namespace ProtoneMedia\AnalyticsEventTracking\Jobs;
4
5
use Illuminate\Bus\Queueable;
6
use Illuminate\Contracts\Queue\ShouldQueue;
7
use Illuminate\Foundation\Bus\Dispatchable;
8
use Illuminate\Queue\InteractsWithQueue;
9
use Illuminate\Queue\SerializesModels;
10
use ProtoneMedia\AnalyticsEventTracking\Analytics\EventBroadcaster;
11
use TheIconic\Tracking\GoogleAnalytics\Analytics;
12
13
class SendEventToAnalytics implements ShouldQueue
14
{
15
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by ProtoneMedia\AnalyticsEv...bs\SendEventToAnalytics: $id, $relations, $class, $keyBy
Loading history...
16
17
    public $event;
18
    public ?string $clientId;
19
    public ?string $userId;
20
21
    public function __construct($event, string $clientId = null, string $userId = null)
22
    {
23
        $this->event    = $event;
24
        $this->clientId = $clientId;
25
        $this->userId   = $userId;
26
    }
27
28
    public function handle(EventBroadcaster $broadcaster)
29
    {
30
        if ($this->clientId) {
31
            $broadcaster->withAnalytics(fn (Analytics $analytics) => $analytics->setClientId($this->clientId));
32
        }
33
34
        if ($this->userId) {
35
            $broadcaster->withAnalytics(fn (Analytics $analytics) => $analytics->setUserId($this->userId));
36
        }
37
38
        $broadcaster->handle($this->event);
39
    }
40
}
41