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

FluidTYPO3 / flux / 18562946304

16 Oct 2025 01:29PM UTC coverage: 92.733% (-0.01%) from 92.743%
18562946304

Pull #2269

github

web-flow
Merge d42591490 into 77e2f503b
Pull Request #2269: [TASK] Extend phpstan baseline to ignore ServerRequest conditions

3 of 4 new or added lines in 2 files covered. (75.0%)

11 existing lines in 2 files now uncovered.

7082 of 7637 relevant lines covered (92.73%)

65.93 hits per line

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

93.33
/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(
19
        ?ConfigurationManagerInterface $configurationManager = null,
20
        ?ServerRequestInterface $request = null
21
    ): ?ContentObjectRenderer
22
    {
23
        $contentObject = null;
14✔
24
        $request ??= $configurationManager !== null && method_exists($configurationManager, 'getRequest')
14✔
UNCOV
25
            ? $configurationManager->getRequest()
×
26
            : ($GLOBALS['TYPO3_REQUEST'] ?? null);
14✔
27

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

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

39
        return $contentObject;
14✔
40
    }
41

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