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.
Passed
Push — master ( 5fe60a...87a739 )
by Ash
02:55
created

AnalyticTracked::broadcastOn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace AshPowell\APAnalytics\Events;
4
5
use Illuminate\Broadcasting\InteractsWithSockets;
6
use Illuminate\Broadcasting\PresenceChannel;
7
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
8
use Illuminate\Foundation\Events\Dispatchable;
9
use Illuminate\Queue\SerializesModels;
10
use use Illuminate\Support\Arr;
0 ignored issues
show
Bug introduced by
A parse error occurred: Syntax error, unexpected T_USE, expecting T_STRING or T_FUNCTION or T_CONST or T_NS_SEPARATOR on line 10 at column 4
Loading history...
11
12
class AnalyticTracked implements ShouldBroadcast
13
{
14
    use Dispatchable, InteractsWithSockets, SerializesModels;
15
16
    public $collection;
17
    public $basename;
18
    public $item;
19
    public $itemId;
20
21
    /**
22
     * Create a new event instance.
23
     *
24
     * @return void
25
     * @param  mixed $item
26
     * @param  mixed $basename
27
     * @param  mixed $collection
28
     */
29
    public function __construct($collection, $basename, $item)
30
    {
31
        $this->queue = 'analytics';
32
33
        $this->collection = $collection;
34
        $this->basename   = $basename;
35
        $this->item       = $item;
36
        $this->itemId     = Arr::get($this->item, "{$this->basename}.id");
37
    }
38
39
    /**
40
     * Get the channels the event should broadcast on.
41
     *
42
     * @return \Illuminate\Broadcasting\Channel|array
43
     */
44
    public function broadcastOn()
45
    {
46
        return new PresenceChannel("analytics.{$this->collection}.{$this->basename}.{$this->itemId}");
47
    }
48
49
    /**
50
     * Get the data to broadcast.
51
     *
52
     * @return array
53
     */
54
    public function broadcastWith()
55
    {
56
        $created_at = Arr::get($this->item, 'created_at') ?? mongoTime();
57
58
        return [
59
            'collection' => $this->collection,
60
            'itemType'   => $this->basename,
61
            'itemId'     => $this->itemId,
62
            'created_at' => $created_at->toDateTime()->format('c'),
63
        ];
64
    }
65
}
66