Completed
Push — master ( e37096...d041e8 )
by Abdelrahman
01:12 queued 11s
created

ContactDeleted   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 47
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 47
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A broadcastOn() 0 4 1
A broadcastAs() 0 4 1
A formatChannelName() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rinvex\Contacts\Events;
6
7
use Rinvex\Contacts\Models\Contact;
8
use Illuminate\Broadcasting\Channel;
9
use Illuminate\Queue\SerializesModels;
10
use Illuminate\Broadcasting\InteractsWithSockets;
11
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
12
13
class ContactDeleted implements ShouldBroadcast
14
{
15
    use SerializesModels;
16
    use InteractsWithSockets;
17
18
    public $contact;
19
20
    /**
21
     * Create a new event instance.
22
     *
23
     * @param \Rinvex\Contacts\Models\Contact $contact
24
     */
25
    public function __construct(Contact $contact)
26
    {
27
        $this->contact = $contact;
28
    }
29
30
    /**
31
     * Get the channels the event should broadcast on.
32
     *
33
     * @return \Illuminate\Broadcasting\Channel
34
     */
35
    public function broadcastOn()
36
    {
37
        return new Channel($this->formatChannelName());
38
    }
39
40
    /**
41
     * The event's broadcast name.
42
     *
43
     * @return string
44
     */
45
    public function broadcastAs()
46
    {
47
        return 'rinvex.contacts.deleted';
48
    }
49
50
    /**
51
     * Format channel name.
52
     *
53
     * @return string
54
     */
55
    protected function formatChannelName(): string
56
    {
57
        return 'rinvex.contacts.list';
58
    }
59
}
60