GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Branch master (70f706)
by Navarr
02:05 queued 19s
created

EchoServer::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
dl 8
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 6
nc 1
nop 2
1
<?php
2
3
// run composer install in top directory
4
require_once __DIR__.'/../vendor/autoload.php';
5
6
use Navarr\Socket\Server;
7
use Navarr\Socket\Socket;
8
9
class EchoServer extends Server
10
{
11
    const DEFAULT_PORT = 7;
12
13
    public function __construct($address = null, $port = self::DEFAULT_PORT)
14
    {
15
        parent::__construct($address, $port);
16
        $this->addHook(Server::HOOK_CONNECT, [$this, 'onConnect']);
17
        $this->addHook(Server::HOOK_INPUT, [$this, 'onInput']);
18
        $this->addHook(Server::HOOK_DISCONNECT, [$this, 'onDisconnect']);
19
        $this->run();
20
    }
21
22
    public function onConnect(Server $server, Socket $client, $message)
23
    {
24
        echo 'Connection Established', "\n";
25
    }
26
27
    public function onInput(Server $server, Socket $client, $message)
28
    {
29
        echo 'Received "', $message, '"', "\n";
30
        $client->write($message, strlen($message));
31
    }
32
33
    public function onDisconnect(Server $server, Socket $client, $message)
34
    {
35
        echo 'Disconnection', "\n";
36
    }
37
}
38
39
$server = new EchoServer('0.0.0.0');
40