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

fnagel / t3extblog / 23823603081

31 Mar 2026 11:05PM UTC coverage: 37.437% (-12.6%) from 50.045%
23823603081

push

github

fnagel
[FEATURE] Add YAML lint to composer scripts and CI

Using the new TYPO3 14.2 built in YAML linter.

https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/13.3/Feature-104973-ActivateLintYamlExecutableForTYPO3.html

1256 of 3355 relevant lines covered (37.44%)

3.11 hits per line

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

52.63
/Classes/Utility/FrontendUtility.php
1
<?php
2

3
namespace FelixNagel\T3extblog\Utility;
4

5
/**
6
 * This file is part of the "t3extblog" Extension for TYPO3 CMS.
7
 *
8
 * For the full copyright and license information, please read the
9
 * LICENSE.txt file that was distributed with this source code.
10
 */
11

12
use Psr\Http\Message\ServerRequestInterface;
13
use TYPO3\CMS\Core\Context\Context;
14
use TYPO3\CMS\Core\Page\PageRenderer;
15
use TYPO3\CMS\Core\SingletonInterface;
16
use TYPO3\CMS\Core\Utility\GeneralUtility;
17
use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
18
use TYPO3\CMS\Frontend\Cache\CacheInstruction;
19

20
/**
21
 * General utility class.
22
 */
23
class FrontendUtility implements SingletonInterface
24
{
25
    /**
26
     * Get FE page UID.
27
     */
28
    public static function getPageUid(): int
7✔
29
    {
30
        return static::getRequest()->getAttribute('frontend.page.information')->getId();
7✔
31
    }
32

33
    /**
34
     * Get FE language UID.
35
     */
36
    public static function getLanguageUid(): int
×
37
    {
38
        return static::getContext()->getAspect('language')->getId();
×
39
    }
40

41
    /**
42
     * CAUTION: disables whole FE cache!
43
     */
44
    public static function disableFrontendCache(): void
×
45
    {
46
        /* @var $cache CacheInstruction */
47
        $cache = static::getRequest()->getAttribute('frontend.cache.instruction');
×
48
        $cache->disableCache('EXT:t3extblog');
×
49
    }
50

51
    /**
52
     * Get page renderer.
53
     */
54
    public static function getPageRenderer(): PageRenderer
×
55
    {
56
        return GeneralUtility::makeInstance(PageRenderer::class);
×
57
    }
58

59
    public static function getFrontendUser(): FrontendUserAuthentication
6✔
60
    {
61
        return static::getRequest()->getAttribute('frontend.user');
6✔
62
    }
63

64
    /**
65
     * Check if FE user is logged in
66
     */
67
    public static function isUserLoggedIn(): bool
3✔
68
    {
69
        return (bool)static::getContext()->getPropertyFromAspect('frontend.user', 'isLoggedIn');
3✔
70
    }
71

72
    /**
73
     * Check if a valid BE login exists.
74
     */
75
    public static function isValidBackendUser(): bool
×
76
    {
77
        return (bool)static::getContext()->getPropertyFromAspect('backend.user', 'isLoggedIn', false);
×
78
    }
79

80
    protected static function getContext(): Context
3✔
81
    {
82
        return GeneralUtility::makeInstance(Context::class);
3✔
83
    }
84

85
    protected static function getRequest(): ServerRequestInterface
13✔
86
    {
87
        return $GLOBALS['TYPO3_REQUEST'];
13✔
88
    }
89
}
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