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

eliashaeussler / typo3-solver / 25001622217

27 Apr 2026 02:41PM UTC coverage: 88.0% (-0.1%) from 88.098%
25001622217

push

github

web-flow
Merge pull request #556 from eliashaeussler/feature/typo3-14.3

902 of 1025 relevant lines covered (88.0%)

2.31 hits per line

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

93.33
/Classes/Utility/HttpUtility.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-2026 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\Utility;
25

26
use Psr\Http\Message;
27
use Symfony\Component\Routing;
28
use TYPO3\CMS\Core;
29

30
/**
31
 * HttpUtility
32
 *
33
 * @author Elias Häußler <elias@haeussler.dev>
34
 * @license GPL-2.0-or-later
35
 */
36
final class HttpUtility
37
{
38
    public static function uriMatchesRequest(string $routePath, Message\RequestInterface $request): bool
2✔
39
    {
40
        $collection = new Core\Routing\RouteCollection();
2✔
41
        $collection->add('_default', new Core\Routing\Route($routePath));
2✔
42

43
        $urlMatcher = new Routing\Matcher\UrlMatcher(
2✔
44
            $collection,
2✔
45
            Routing\RequestContext::fromUri((string)$request->getUri()),
2✔
46
        );
2✔
47

48
        try {
49
            return (bool)$urlMatcher->match($request->getUri()->getPath());
2✔
50
        } catch (\Exception) {
1✔
51
            return false;
1✔
52
        }
53
    }
54

55
    public static function getServerRequest(): Message\ServerRequestInterface
1✔
56
    {
57
        $serverRequest = $GLOBALS['TYPO3_REQUEST'] ?? null;
1✔
58

59
        if ($serverRequest instanceof Message\ServerRequestInterface) {
1✔
60
            return $serverRequest;
1✔
61
        }
62

63
        return Core\Http\ServerRequestFactory::fromGlobals();
×
64
    }
65
}
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