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

sirn-se / websocket-php / 8346487915

19 Mar 2024 04:15PM UTC coverage: 22.584% (-77.4%) from 100.0%
8346487915

push

github

sirn-se
Temp test verification

2 of 2 new or added lines in 1 file covered. (100.0%)

742 existing lines in 32 files now uncovered.

222 of 983 relevant lines covered (22.58%)

0.23 hits per line

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

81.82
/src/Middleware/ProcessHttpStack.php
1
<?php
2

3
/**
4
 * Copyright (C) 2014-2024 Textalk and contributors.
5
 * This file is part of Websocket PHP and is free software under the ISC License.
6
 */
7

8
namespace WebSocket\Middleware;
9

10
use Stringable;
11
use WebSocket\Connection;
12
use WebSocket\Http\{
13
    HttpHandler,
14
    Message
15
};
16
use WebSocket\Trait\StringableTrait;
17

18
/**
19
 * WebSocket\Middleware\ProcessHttpStack class.
20
 * Worker stack for HTTP middleware implementations.
21
 */
22
class ProcessHttpStack implements Stringable
23
{
24
    use StringableTrait;
25

26
    private $connection;
27
    private $httpHandler;
28
    private $processors;
29

30
    /**
31
     * Create ProcessStack.
32
     * @param Connection $connection
33
     * @param HttpHandler $httpHandler
34
     * @param array $processors
35
     */
36
    public function __construct(Connection $connection, HttpHandler $httpHandler, array $processors)
37
    {
38
        $this->connection = $connection;
1✔
39
        $this->httpHandler = $httpHandler;
1✔
40
        $this->processors = $processors;
1✔
41
    }
42

43
    /**
44
     * Process middleware for incoming htpp message.
45
     * @return Message
46
     */
47
    public function handleHttpIncoming(): Message
48
    {
49
        $processor = array_shift($this->processors);
1✔
50
        if ($processor) {
1✔
UNCOV
51
            return $processor->processHttpIncoming($this, $this->connection);
×
52
        }
53
        return $this->httpHandler->pull();
1✔
54
    }
55

56
    /**
57
     * Process middleware for outgoing htpp message.
58
     * @param Message $message
59
     * @return Message
60
     */
61
    public function handleHttpOutgoing(Message $message): Message
62
    {
63
        $processor = array_shift($this->processors);
1✔
64
        if ($processor) {
1✔
UNCOV
65
            return $processor->processHttpOutgoing($this, $this->connection, $message);
×
66
        }
67
        return $this->httpHandler->push($message);
1✔
68
    }
69
}
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