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

FluidTYPO3 / flux / 17904759627

15 Sep 2025 08:47AM UTC coverage: 90.676% (-2.1%) from 92.767%
17904759627

push

github

NamelessCoder
[TASK] Set beta stability

6924 of 7636 relevant lines covered (90.68%)

9.49 hits per line

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

86.67
/Classes/Utility/ContentObjectFetcher.php
1
<?php
2
namespace FluidTYPO3\Flux\Utility;
3

4
/*
5
 * This file is part of the FluidTYPO3/Flux project under GPLv2 or later.
6
 *
7
 * For the full copyright and license information, please read the
8
 * LICENSE.md file that was distributed with this source code.
9
 */
10

11
use Psr\Http\Message\ServerRequestInterface;
12
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
13
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
14
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
15

16
class ContentObjectFetcher
17
{
18
    public static function resolve(?ConfigurationManagerInterface $configurationManager = null): ?ContentObjectRenderer
19
    {
20
        $contentObject = null;
2✔
21
        $request = $configurationManager !== null && method_exists($configurationManager, 'getRequest')
2✔
22
            ? $configurationManager->getRequest()
×
23
            : ($GLOBALS['TYPO3_REQUEST'] ?? null);
2✔
24

25
        if ($request) {
2✔
26
            $contentObject = static::resolveFromRequest($request);
2✔
27
        }
28

29
        if ($contentObject === null
2✔
30
            && $configurationManager !== null
2✔
31
            && method_exists($configurationManager, 'getContentObject')
2✔
32
        ) {
33
            $contentObject = $configurationManager->getContentObject();
2✔
34
        }
35

36
        return $contentObject;
2✔
37
    }
38

39
    protected static function resolveFromRequest(ServerRequestInterface $request): ?ContentObjectRenderer
40
    {
41
        if (($cObject = $request->getAttribute('currentContentObject')) instanceof ContentObjectRenderer) {
2✔
42
            return $cObject;
×
43
        }
44
        /** @var TypoScriptFrontendController $controller */
45
        $controller = $request->getAttribute('frontend.controller');
2✔
46
        return $controller instanceof TypoScriptFrontendController ? $controller->cObj : null;
2✔
47
    }
48
}
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