Completed
Push — master ( 7c39f2...831177 )
by Jeroen
04:12
created

PingMessage   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 5
dl 0
loc 17
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A handle() 0 7 3
1
<?php
2
3
namespace Jerodev\PhpIrcClient\Messages;
4
5
use Jerodev\PhpIrcClient\IrcClient;
6
7
class PingMessage extends IrcMessage
8
{
9
    public function __construct(string $message)
10
    {
11
        parent::__construct($message);
12
    }
13
    
14
    /**
15
     *  Reply the ping message with a pong response
16
     */
17
    public function handle(IrcClient $client, bool $force = false): void
18
    {
19
        if ($this->handled && !$force) {
20
            return;
21
        }
22
        
23
        $client->sendCommand("PONG :$this->payload");
24
    }
25
}
26