CandidateRated   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 39
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A broadcastOn() 0 3 1
1
<?php
2
3
namespace App\Events;
4
5
use App\Models\Candidate;
6
use Illuminate\Broadcasting\InteractsWithSockets;
7
use Illuminate\Broadcasting\PrivateChannel;
8
use Illuminate\Foundation\Events\Dispatchable;
9
use Illuminate\Queue\SerializesModels;
10
11
class CandidateRated
12
{
13
    use Dispatchable;
14
    use InteractsWithSockets;
15
    use SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by App\Events\CandidateRated: $id, $relations, $class, $connection, $keyBy
Loading history...
16
17
    /**
18
     * @var Candidate
19
     */
20
    public $candidate;
21
22
    public $userId;
23
    public $previousRate;
24
    public $newRate;
25
26
    /**
27
     * Create a new event instance.
28
     *
29
     * @param Candidate $candidate
30
     * @param $previousRate
31
     * @param $newRate
32
     * @param $userId
33
     */
34
    public function __construct(Candidate $candidate, $previousRate, $newRate, $userId)
35
    {
36
        $this->candidate = $candidate;
37
        $this->previousRate = $previousRate;
38
        $this->newRate = $newRate;
39
        $this->userId = $userId;
40
    }
41
42
    /**
43
     * Get the channels the event should broadcast on.
44
     *
45
     * @return \Illuminate\Broadcasting\Channel|array
46
     */
47
    public function broadcastOn()
48
    {
49
        return new PrivateChannel('channel-name');
50
    }
51
}
52