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

FluidTYPO3 / flux / 27757211628

18 Jun 2026 11:46AM UTC coverage: 89.162% (-3.5%) from 92.646%
27757211628

Pull #2288

github

web-flow
Merge 967f03443 into 2614049c6
Pull Request #2288: [FEATURE] Prepare for v14 support

210 of 348 new or added lines in 56 files covered. (60.34%)

121 existing lines in 9 files now uncovered.

6228 of 6985 relevant lines covered (89.16%)

40.84 hits per line

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

70.59
/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\Core\Utility\GeneralUtility;
13
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
14
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
15
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
16

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

28
        if ($request) {
44✔
29
            $contentObject = static::resolveFromRequest($request);
44✔
30
        }
31

32
        if ($contentObject === null
44✔
33
            && $configurationManager !== null
44✔
34
            && method_exists($configurationManager, 'getContentObject')
44✔
35
        ) {
UNCOV
36
            $contentObject = $configurationManager->getContentObject();
×
37
        }
38

39
        if ($contentObject === null) {
44✔
NEW
40
            $contentObject = GeneralUtility::makeInstance(ContentObjectRenderer::class);
×
41
        }
42

43
        return $contentObject;
44✔
44
    }
45

46
    protected static function resolveFromRequest(ServerRequestInterface $request): ?ContentObjectRenderer
47
    {
48
        if (($cObject = $request->getAttribute('currentContentObject')) instanceof ContentObjectRenderer) {
44✔
49
            return $cObject;
44✔
50
        }
51
        /** @var TypoScriptFrontendController $controller */
UNCOV
52
        $controller = $request->getAttribute('frontend.controller');
×
UNCOV
53
        return $controller instanceof TypoScriptFrontendController ? $controller->cObj : null;
×
54
    }
55
}
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