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

eliashaeussler / typo3-solver / 13217374172

08 Feb 2025 04:27PM UTC coverage: 89.843% (+2.7%) from 87.159%
13217374172

push

github

web-flow
[TASK] Update @eslint/js to v9.20.0

| datasource | package    | from   | to     |
| ---------- | ---------- | ------ | ------ |
| npm        | @eslint/js | 9.19.0 | 9.20.0 |

858 of 955 relevant lines covered (89.84%)

6.95 hits per line

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

63.64
/Classes/Middleware/PingMiddleware.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the TYPO3 CMS extension "solver".
7
 *
8
 * Copyright (C) 2023-2025 Elias Häußler <elias@haeussler.dev>
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation, either version 2 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22
 */
23

24
namespace EliasHaeussler\Typo3Solver\Middleware;
25

26
use EliasHaeussler\SSE;
27
use EliasHaeussler\Typo3Solver\Utility;
28
use Psr\Http\Message;
29
use Psr\Http\Server;
30
use TYPO3\CMS\Core;
31

32
/**
33
 * PingMiddleware
34
 *
35
 * @author Elias Häußler <elias@haeussler.dev>
36
 * @license GPL-2.0-or-later
37
 */
38
final class PingMiddleware implements Server\MiddlewareInterface
39
{
40
    public const ROUTE_PATH = '/tx_solver/ping';
41

42
    /**
43
     * @throws SSE\Exception\StreamIsActive
44
     * @throws SSE\Exception\StreamIsClosed
45
     * @throws SSE\Exception\StreamIsInactive
46
     */
47
    public function process(
4✔
48
        Message\ServerRequestInterface $request,
49
        Server\RequestHandlerInterface $handler,
50
    ): Message\ResponseInterface {
51
        // Pass through request if it's not supported
52
        if (!$this->isRequestSupported($request)) {
4✔
53
            return $handler->handle($request);
4✔
54
        }
55

56
        $eventStream = SSE\Stream\SelfEmittingEventStream::create();
×
57
        $eventStream->open();
×
58
        $eventStream->close();
×
59

60
        return new Core\Http\Response();
×
61
    }
62

63
    private function isRequestSupported(Message\ServerRequestInterface $request): bool
4✔
64
    {
65
        if (!SSE\Stream\SelfEmittingEventStream::canHandle($request)) {
4✔
66
            return false;
2✔
67
        }
68

69
        return Utility\HttpUtility::uriMatchesRequest(self::ROUTE_PATH, $request);
2✔
70
    }
71
}
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

© 2025 Coveralls, Inc