Completed
Push — master ( 58043b...413e7c )
by Sergi Tur
06:39
created

UserHasBeenMigrated::setChannelName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 4
loc 4
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Acacha\Users\Events;
4
5
use Illuminate\Broadcasting\Channel;
6
use Illuminate\Queue\SerializesModels;
7
use Illuminate\Foundation\Events\Dispatchable;
8
use Illuminate\Broadcasting\InteractsWithSockets;
9
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
10
11
/**
12
 * Class UserHasBeenMigrated
13
 *
14
 * @package Acacha\Users\Events
15
 */
16 View Code Duplication
class UserHasBeenMigrated implements ShouldBroadcast
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
{
18
    use Dispatchable, InteractsWithSockets, SerializesModels;
19
20
    /**
21
     * Source user id.
22
     *
23
     * @var
24
     */
25
    public $sourceUserId;
26
27
    /**
28
     * Source user.
29
     *
30
     * @var
31
     */
32
    public $sourceUser;
33
34
    /**
35
     * New user.
36
     *
37
     * @var
38
     */
39
    public $newUser;
40
41
    /**
42
     * User migration batch id.
43
     *
44
     * @var
45
     */
46
    public $user_migration_batch_id;
47
48
    /**
49
     * Broadcast channel name.
50
     *
51
     * @var string
52
     */
53
    protected $channelName = 'users-migration';
54
55
    /**
56
     * @return string
57
     */
58
    public function getChannelName()
59
    {
60
        return $this->channelName;
61
    }
62
63
    /**
64
     * @param string $channelName
65
     */
66
    public function setChannelName($channelName)
67
    {
68
        $this->channelName = $channelName;
69
    }
70
71
    /**
72
     * UserHasBeenMigrated constructor.
73
     *
74
     * @param $sourceUserId
75
     * @param $sourceUser
76
     * @param $newUser
77
     * @param $user_migration_batch_id
78
     */
79
    public function __construct($sourceUserId, $sourceUser, $newUser, $user_migration_batch_id)
80
    {
81
        $this->sourceUserId = $sourceUserId;
82
        $this->sourceUser = $sourceUser;
83
        $this->newUser = $newUser;
84
        $this->user_migration_batch_id = $user_migration_batch_id;
85
    }
86
87
    /**
88
     * Get the channels the event should broadcast on.
89
     *
90
     * @return Channel|array
91
     */
92
    public function broadcastOn()
93
    {
94
        return new Channel($this->channelName);
95
    }
96
}
97