Server   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 36.36%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 25
ccs 4
cts 11
cp 0.3636
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A createConnection() 0 11 1
1
<?php
2
3
namespace SamIT\React\Smtp;
4
5
use Evenement\EventEmitter;
6
use React\EventLoop\LoopInterface;
7
use React\Http\ServerInterface;
8
use React\Socket\ServerInterface as SocketServerInterface;
9
use React\Socket\ConnectionInterface;
10
11
/** @event request */
12
class Server extends \React\Socket\Server
13
{
14
    public $recipientLimit = 100;
15
    public $bannerDelay = 0;
16
17
    private $loop;
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
18 2
    public function __construct(LoopInterface $loop)
19
    {
20
        // We need to save $loop here since it is private for some reason.
21 2
        $this->loop = $loop;
22 2
        parent::__construct($loop);
23 2
    }
24
25
    public function createConnection($socket)
26
    {
27
        $conn = new Connection($socket, $this->loop);
28
        $conn->recipientLimit = $this->recipientLimit;
29
        $conn->bannerDelay = $this->bannerDelay;
30
        // We let messages "bubble up" from the connection to the server.
31
        $conn->on('message', function() {
32
            $this->emit('message', func_get_args());
33
        });
34
        return $conn;
35
    }
36
}
37