Completed
Pull Request — master (#447)
by Alexandru
01:32
created

MockableConnection::close()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace BeyondCode\LaravelWebSockets\Server;
4
5
use Ratchet\ConnectionInterface;
6
use stdClass;
7
8
class MockableConnection implements ConnectionInterface
9
{
10
    /**
11
     * Create a new Mockable connection.
12
     *
13
     * @param  string|int  $appId
14
     * @param  string  $socketId
15
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
16
     */
17
    public function __construct($appId, string $socketId)
18
    {
19
        $this->app = new stdClass;
0 ignored issues
show
Bug introduced by
The property app does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
20
21
        $this->app->id = $appId;
22
        $this->socketId = $socketId;
0 ignored issues
show
Bug introduced by
The property socketId does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
23
    }
24
25
    /**
26
     * Send data to the connection.
27
     *
28
     * @param  string  $data
29
     * @return \Ratchet\ConnectionInterface
30
     */
31
    public function send($data)
32
    {
33
        //
34
    }
35
36
    /**
37
     * Close the connection.
38
     *
39
     * @return void
40
     */
41
    public function close()
42
    {
43
        //
44
    }
45
}
46