Plugin::createPing()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 8
rs 9.4285
1
<?php
2
declare(strict_types=1);
3
4
namespace Spires\Plugins\PingPong;
5
6
use Spires\Plugins\PingPong\Inbound\PingSystemMessage;
7
use Spires\Plugins\SystemMessage\Inbound\SystemMessage;
8
9
class Plugin
10
{
11
    /**
12
     * @param SystemMessage $message
13
     * @return null|PingSystemMessage
14
     */
15
    public function createPing(SystemMessage $message)
16
    {
17
        if ($message->command() === 'PING') {
18
            return PingSystemMessage::from($message);
19
        }
20
21
        return null;
22
    }
23
24
    public function sendPong(PingSystemMessage $ping)
25
    {
26
        $ping->pong();
27
    }
28
}
29