Passed
Push — master ( 605a7f...c53e78 )
by Marcel
14:27 queued 03:25
created

WebSocketMessageReceived   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
1
<?php
2
3
namespace BeyondCode\LaravelWebSockets\Events;
4
5
use Illuminate\Foundation\Events\Dispatchable;
6
use Illuminate\Queue\SerializesModels;
7
use Ratchet\RFC6455\Messaging\MessageInterface;
8
9
class WebSocketMessageReceived
10
{
11
    use Dispatchable, SerializesModels;
0 ignored issues
show
introduced by
The trait Illuminate\Queue\SerializesModels requires some properties which are not provided by BeyondCode\LaravelWebSoc...ebSocketMessageReceived: $id, $relations, $class, $connection, $keyBy
Loading history...
12
13
    /**
14
     * The WebSockets app id that the user connected to.
15
     *
16
     * @var string
17
     */
18
    public $appId;
19
20
    /**
21
     * The Socket ID associated with the connection.
22
     *
23
     * @var string
24
     */
25
    public $socketId;
26
27
    /**
28
     * The message received.
29
     *
30
     * @var MessageInterface
31
     */
32
    public $message;
33
34
    /**
35
     * The decoded message as array.
36
     *
37
     * @var array
38
     */
39
    public $decodedMessage;
40
41
    /**
42
     * Create a new event instance.
43
     *
44
     * @param  string  $appId
45
     * @param  string  $socketId
46
     * @param  MessageInterface  $message
47
     * @return void
48
     */
49
    public function __construct(string $appId, string $socketId, MessageInterface $message)
50
    {
51
        $this->appId = $appId;
52
        $this->socketId = $socketId;
53
        $this->message = $message;
54
        $this->decodedMessage = json_decode($message->getPayload(), true);
55
    }
56
}
57