Plugin   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 20
rs 10
wmc 3
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A createPing() 0 8 2
A sendPong() 0 4 1
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