• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

sirn-se / websocket-php / 5610959835

pending completion
5610959835

push

github

Sören Jensen
Middleware support

14 of 14 new or added lines in 4 files covered. (100.0%)

283 of 676 relevant lines covered (41.86%)

1.66 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Middleware/PingResponder.php
1
<?php
2

3
/**
4
 * Copyright (C) 2014-2023 Textalk and contributors.
5
 *
6
 * This file is part of Websocket PHP and is free software under the ISC License.
7
 * License text: https://raw.githubusercontent.com/sirn-se/websocket-php/master/COPYING.md
8
 */
9

10
namespace WebSocket\Middleware;
11

12
use WebSocket\Connection;
13
use WebSocket\Message\{
14
    Ping,
15
    Pong,
16
    Message
17
};
18

19
/**
20
 * WebSocket\Middleware\PingResponder class.
21
 * Responds on incoming ping messages.
22
 */
23
class PingResponder implements ProcessIncomingInterface
24
{
25
    public function processIncoming(ProcessStack $stack, Connection $connection): Message
26
    {
27
        $message = $stack->handleIncoming();
×
28
        if ($message instanceof Ping) {
×
29
            $connection->pushMessage(new Pong($message->getContent()));
×
30
        }
31
        return $message;
×
32
    }
33

34
    public function __toString(): string
35
    {
36
        return get_class($this);
×
37
    }
38
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc