Passed
Push — master ( bc355e...639701 )
by Adam
25:37
created

PostVoted::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 0

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 0
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 2
rs 10
1
<?php
2
3
namespace Coyote\Events;
4
5
use Illuminate\Broadcasting\Channel;
6
use Illuminate\Broadcasting\InteractsWithSockets;
7
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
8
use Illuminate\Foundation\Events\Dispatchable;
9
use Illuminate\Queue\SerializesModels;
10
11
class PostVoted extends BroadcastEvent implements ShouldBroadcast
12
{
13
    use Dispatchable, InteractsWithSockets, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by Coyote\Events\PostVoted: $id, $relations, $class, $connection, $keyBy
Loading history...
14
15
    public function __construct(public $payload, private int $topicId)
16
    {
17
    }
18
19
    /**
20
     * @return Channel|Channel[]
21
     */
22
    public function broadcastOn()
23
    {
24
        return new Channel('topic:' . $this->topicId);
25
    }
26
27
    /**
28
     * @return array
29
     */
30
    public function broadcastWith()
31
    {
32
        return $this->payload;
33
    }
34
}
35