TopicUpVoted   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 32
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A broadcastOn() 0 4 1
1
<?php
2
3
namespace PHPHub\Events;
4
5
use Illuminate\Queue\SerializesModels;
6
use PHPHub\Topic;
7
8
class TopicUpVoted extends Event
9
{
10
    use SerializesModels, ShouldNotifyTrait;
11
12
    /**
13
     * 设置生成的通知类型.
14
     *
15
     * @var string
16
     */
17
    protected $notification_type = 'topic_upvote';
18
19
    /**
20
     * Create a new event instance.
21
     *
22
     * @param Topic $topic 被赞用户
23
     * @param $by_user int 点赞用户
24
     */
25
    public function __construct(Topic $topic, $by_user)
26
    {
27
        $this->setNotificationInfoFromTopic($topic, $by_user);
28
    }
29
30
    /**
31
     * Get the channels the event should be broadcast on.
32
     *
33
     * @return array
34
     */
35
    public function broadcastOn()
36
    {
37
        return [];
38
    }
39
}
40