Completed
Push — master ( 104e68...b4839f )
by Maxime
12s
created

PingFrameHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 4
dl 0
loc 12
ccs 5
cts 5
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A supports() 0 4 1
A process() 0 4 1
1
<?php
2
/**
3
 * This file is a part of Woketo package.
4
 *
5
 * (c) Nekland <[email protected]>
6
 *
7
 * For the full license, take a look to the LICENSE file
8
 * on the root directory of this project
9
 */
10
11
namespace Nekland\Woketo\Rfc6455\MessageHandler;
12
13
use Nekland\Woketo\Rfc6455\Frame;
14
use Nekland\Woketo\Rfc6455\Message;
15
use Nekland\Woketo\Rfc6455\MessageProcessor;
16
use React\Stream\Stream;
17
18
class PingFrameHandler implements Rfc6455MessageHandlerInterface
19
{
20 2
    public function supports(Message $message)
21
    {
22 2
        return $message->getFirstFrame()->getOpcode() === Frame::OP_PING;
23
    }
24
25 2
    public function process(Message $message, MessageProcessor $messageProcessor, Stream $socket)
26
    {
27 2
        $messageProcessor->write($messageProcessor->getFrameFactory()->createPongFrame($message->getContent()), $socket);
28 2
    }
29
}
30