Passed
Push — master ( 4fb5c8...2400d0 )
by Johnny
05:58
created

NewVisitorEvent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
/**
4
 * NewVisitorEvent.php
5
 *
6
 * Laravel identification for the Tracker Facade defined in
7
 * TrackerServiceProvider.php.
8
 *
9
 * PHP version 7.2
10
 *
11
 * @category Events
12
 * @package  RedboxTracker
13
 * @author   Johnny Mast <[email protected]>
14
 * @license  https://opensource.org/licenses/MIT MIT
15
 * @link     https://github.com/johnnymast/redbox-tracker
16
 * @since    GIT:1.0
17
 */
18
19
namespace Redbox\Tracker\Events;
20
21
use Illuminate\Broadcasting\InteractsWithSockets;
22
use Illuminate\Foundation\Events\Dispatchable;
23
use Illuminate\Broadcasting\PresenceChannel;
24
use Illuminate\Broadcasting\PrivateChannel;
25
use Illuminate\Queue\SerializesModels;
26
use Illuminate\Broadcasting\Channel;
27
use Redbox\Tracker\Visitor;
28
29
/**
30
 * Class NewVisitorEvent
31
 *
32
 * Identifies the Tracker Facade.
33
 *
34
 * PHP version 7.2
35
 *
36
 * @category Events
37
 * @package  RedboxTracker
38
 * @author   Johnny Mast <[email protected]>
39
 * @license  https://opensource.org/licenses/MIT MIT
40
 * @link     https://github.com/johnnymast/redbox-tracker
41
 * @since    GIT:1.0
42
 */
43
class NewVisitorEvent
44
{
45
    use Dispatchable;
46
47
    /**
48
     * @var Visitor $visitor the new visitor
49
     */
50
    public $visitor;
51
52
    /**
53
     * Create a new event instance.
54
     *
55
     * @param Visitor $visitor The newly created visitor.
56
     */
57
    public function __construct(Visitor $visitor)
58
    {
59
        $this->visitor = $visitor;
60
    }
61
62
    /**
63
     * Get the channels the event should broadcast on.
64
     *
65
     * @return PrivateChannel
66
     */
67
    public function broadcastOn()
68
    {
69
        return new PrivateChannel(config('redbox-tracker.events.channel'));
70
    }
71
}
72