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

eliashaeussler / typo3-warming / 10986090372

23 Sep 2024 01:19AM UTC coverage: 91.282%. Remained the same
10986090372

Pull #709

github

web-flow
[TASK] Update @rollup/plugin-typescript to v12

| datasource | package                   | from   | to     |
| ---------- | ------------------------- | ------ | ------ |
| npm        | @rollup/plugin-typescript | 11.1.6 | 12.1.0 |
Pull Request #709: [TASK] Update @rollup/plugin-typescript to v12

1089 of 1193 relevant lines covered (91.28%)

8.31 hits per line

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

81.82
/Classes/Form/FormDataProvider/SimulateLogPageRow.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the TYPO3 CMS extension "warming".
7
 *
8
 * Copyright (C) 2021-2024 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\Typo3Warming\Form\FormDataProvider;
25

26
use EliasHaeussler\Typo3Warming\Domain;
27
use TYPO3\CMS\Backend;
28
use TYPO3\CMS\Core;
29

30
/**
31
 * SimulateLogPageRow
32
 *
33
 * @author Elias Häußler <elias@haeussler.dev>
34
 * @license GPL-2.0-or-later
35
 * @internal
36
 */
37
final class SimulateLogPageRow implements Backend\Form\FormDataProviderInterface
38
{
39
    /**
40
     * @param array<string, mixed> $result
41
     * @return array<string, mixed>
42
     */
43
    public function addData(array $result): array
1✔
44
    {
45
        $tableName = $result['tableName'] ?? null;
1✔
46
        $databaseRow = $result['databaseRow'] ?? null;
1✔
47

48
        // Only log tables are handled by this data provider
49
        if ($tableName !== Domain\Model\Log::TABLE_NAME) {
1✔
50
            return $result;
×
51
        }
52

53
        // Early return if database row is an unexpected value
54
        if (!is_array($databaseRow)) {
1✔
55
            return $result;
×
56
        }
57

58
        $rootPageId = $databaseRow['site'] ?? null;
1✔
59
        $url = $databaseRow['url'] ?? null;
1✔
60

61
        if (is_string($url)) {
1✔
62
            $result['databaseRow']['pid'] = $this->resolvePageId($url) ?? $rootPageId;
1✔
63
        }
64

65
        return $result;
1✔
66
    }
67

68
    private function resolvePageId(string $url): ?int
1✔
69
    {
70
        $request = new Core\Http\ServerRequest($url);
1✔
71

72
        $siteMatcher = Core\Utility\GeneralUtility::makeInstance(Core\Routing\SiteMatcher::class);
1✔
73
        $routeResult = $siteMatcher->matchRequest($request);
1✔
74

75
        if (!($routeResult instanceof Core\Routing\SiteRouteResult) || !($routeResult->getSite() instanceof Core\Site\Entity\Site)) {
1✔
76
            return null;
×
77
        }
78

79
        $pageArguments = $routeResult->getSite()->getRouter()->matchRequest($request, $routeResult);
1✔
80

81
        if (!($pageArguments instanceof Core\Routing\PageArguments)) {
1✔
82
            return null;
×
83
        }
84

85
        return $pageArguments->getPageId();
1✔
86
    }
87
}
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