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

eliashaeussler / typo3-warming / 27006274671

05 Jun 2026 09:12AM UTC coverage: 93.733% (-0.3%) from 94.003%
27006274671

push

github

web-flow
Merge pull request #1180 from eliashaeussler/fix/exclude

[BUGFIX] Re-add dev-only files to packaging excludes

1735 of 1851 relevant lines covered (93.73%)

13.0 hits per line

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

45.0
/Classes/Domain/Repository/LocalizationRepository.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-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\Typo3Warming\Domain\Repository;
25

26
use TYPO3\CMS\Backend;
27
use TYPO3\CMS\Core;
28

29
/**
30
 * LocalizationRepository
31
 *
32
 * @author Elias Häußler <elias@haeussler.dev>
33
 * @license GPL-2.0-or-later
34
 * @internal
35
 *
36
 * @todo Remove once support for TYPO3 v13 is dropped
37
 */
38
final readonly class LocalizationRepository
39
{
40
    private Core\Information\Typo3Version $typo3Version;
41

42
    public function __construct(
42✔
43
        private Backend\Domain\Repository\Localization\LocalizationRepository $baseRepository,
44
        private Core\Domain\RecordFactory $recordFactory,
45
    ) {
46
        $this->typo3Version = new Core\Information\Typo3Version();
42✔
47
    }
48

49
    public function getPageTranslation(int $pageId, int $languageId, bool $includeHidden = true): ?Core\Domain\RawRecord
24✔
50
    {
51
        if ($languageId <= 0) {
24✔
52
            return null;
×
53
        }
54

55
        if ($this->typo3Version->getMajorVersion() >= 14) {
24✔
56
            $pageTranslations = $this->baseRepository->getPageTranslations($pageId, [$languageId]);
24✔
57

58
            foreach ($pageTranslations as $pageTranslation) {
24✔
59
                if ($includeHidden || !($pageTranslation->toArray()['hidden'] ?? false)) {
24✔
60
                    return $pageTranslation;
24✔
61
                }
62
            }
63

64
            return null;
×
65
        }
66

67
        // @todo Remove everything below once support for TYPO3 v13 is dropped
68
        $pageTranslations = Backend\Utility\BackendUtility::getRecordLocalization(
×
69
            'pages',
×
70
            $pageId,
×
71
            $languageId,
×
72
            $includeHidden ? '' : 'hidden = 0',
×
73
        );
×
74

75
        if ($pageTranslations !== false && $pageTranslations !== []) {
×
76
            return $this->recordFactory->createRawRecord('pages', $pageTranslations[0]);
×
77
        }
78

79
        return null;
×
80
    }
81
}
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