Server   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __invoke() 0 21 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Antidot\React\Socket;
6
7
use Ratchet\Http\HttpServer;
8
use Ratchet\Server\IoServer;
9
use Ratchet\Wamp\WampServer;
10
use Ratchet\WebSocket\WsServer;
11
use React\EventLoop\Factory;
12
13
class Server
14
{
15
    public function __invoke(array $config): void
16
    {
17
        $loop = Factory::create();
18
        $application = new Application();
19
        $loop->addTimer(0.001, function($timer) use ($config) {
0 ignored issues
show
Unused Code introduced by
The parameter $timer is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

19
        $loop->addTimer(0.001, function(/** @scrutinizer ignore-unused */ $timer) use ($config) {

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
20
            echo \sprintf("Socket server listening to tcp://%s.\n", $config['uri']);
21
        });
22
23
        $webSocket = new \React\Socket\Server($config['uri'], $loop);
24
        $server = new IoServer(
0 ignored issues
show
Unused Code introduced by
The assignment to $server is dead and can be removed.
Loading history...
25
            new HttpServer(
26
                new WsServer(
27
                    new WampServer(
28
                        $application
29
                    )
30
                )
31
            ),
32
            $webSocket
33
        );
34
35
        $loop->run();
36
    }
37
}
38