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

PostVoted   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A broadcastWith() 0 3 1
A broadcastOn() 0 3 1
A __construct() 0 2 1
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