PingSystemMessage   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 21
rs 10
wmc 3
lcom 1
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A server1() 0 6 1
A server2() 0 6 1
A pong() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Spires\Plugins\PingPong\Inbound;
5
6
use Spires\Plugins\SystemMessage\Inbound\SystemMessage;
7
8
class PingSystemMessage extends SystemMessage
9
{
10
    public function server1() : string
11
    {
12
        $servers = explode(' ', $this->params());
13
14
        return ltrim($servers[0], ':');
15
    }
16
17
    public function server2()
18
    {
19
        $servers = explode(' ', $this->params());
20
21
        return ltrim(($servers[1] ?? ''), ':');
22
    }
23
24
    public function pong()
25
    {
26
        send_command('PONG', "{$this->server1()} {$this->server2()}");
27
    }
28
}
29