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

eliashaeussler / typo3-warming / 24313471134

12 Apr 2026 06:30PM UTC coverage: 93.861% (-0.06%) from 93.919%
24313471134

push

github

web-flow
Merge pull request #1140 from eliashaeussler/fix/be-user

11 of 12 new or added lines in 6 files covered. (91.67%)

1697 of 1808 relevant lines covered (93.86%)

12.72 hits per line

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

88.89
/Classes/Utility/BackendUtility.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\Utility;
25

26
use TYPO3\CMS\Core;
27

28
/**
29
 * BackendUtility
30
 *
31
 * @author Elias Häußler <elias@haeussler.dev>
32
 * @license GPL-2.0-or-later
33
 */
34
final class BackendUtility
35
{
36
    public static function getBackendUser(): ?Core\Authentication\BackendUserAuthentication
41✔
37
    {
38
        $backendUser = $GLOBALS['BE_USER'] ?? null;
41✔
39

40
        if (!($backendUser instanceof Core\Authentication\BackendUserAuthentication)) {
41✔
NEW
41
            return null;
×
42
        }
43

44
        return $backendUser;
41✔
45
    }
46

47
    /**
48
     * @todo Drop in favor of TranslatorInterface once support for TYPO3 v13 is dropped
49
     */
50
    public static function getLanguageService(): Core\Localization\LanguageService
41✔
51
    {
52
        return Core\Utility\GeneralUtility::makeInstance(Core\Localization\LanguageServiceFactory::class)
41✔
53
            ->createFromUserPreferences(self::getBackendUser())
41✔
54
        ;
41✔
55
    }
56
}
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