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

FluidTYPO3 / flux / 27757675993

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

push

github

NamelessCoder
[TASK] Address last phpstan warnings

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

97.44
/Classes/Integration/FormEngine/ProviderProcessor.php
1
<?php
2
namespace FluidTYPO3\Flux\Integration\FormEngine;
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 FluidTYPO3\Flux\Content\ContentTypeManager;
12
use FluidTYPO3\Flux\Provider\Interfaces\DataStructureProviderInterface;
13
use FluidTYPO3\Flux\Provider\ProviderResolver;
14
use FluidTYPO3\Flux\Proxy\SiteFinderProxy;
15
use TYPO3\CMS\Backend\Form\FormDataProviderInterface;
16
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
17
use TYPO3\CMS\Core\Utility\GeneralUtility;
18

19
class ProviderProcessor implements FormDataProviderInterface
20
{
21
    private ProviderResolver $resolver;
22
    private ContentTypeManager $contentTypeManager;
23
    private SiteFinderProxy $siteFinder;
24

25
    public function __construct(
26
        ProviderResolver $resolver,
27
        ContentTypeManager $contentTypeManager,
28
        SiteFinderProxy $siteFinder
29
    ) {
30
        $this->resolver = $resolver;
24✔
31
        $this->contentTypeManager = $contentTypeManager;
24✔
32
        $this->siteFinder = $siteFinder;
24✔
33
    }
34

35
    public function addData(array $result): array
36
    {
37
        if (!isset($result['tableName'])) {
24✔
38
            throw new \UnexpectedValueException('Input data requires a "tableName" property', 1666816552);
4✔
39
        }
40
        if (!isset($result['databaseRow'])) {
20✔
41
            throw new \UnexpectedValueException('Input data requires a "databaseRow" property', 1666816552);
4✔
42
        }
43
        if ($result['tableName'] === 'tt_content') {
16✔
44
            $pageUid = $result['parentPageRow']['uid'];
12✔
45
            if ($pageUid > 0) {
12✔
46
                $enabledContentTypes = [];
12✔
47
                try {
48
                    $site = $this->siteFinder->getSiteByPageId($pageUid);
12✔
49
                    $siteConfiguration = $site->getConfiguration();
4✔
50
                    if (is_array($siteConfiguration['flux_content_types'] ?? null)) {
4✔
51
                        $enabledContentTypes = $siteConfiguration['flux_content_types'];
×
52
                    } else {
53
                        $enabledContentTypes = GeneralUtility::trimExplode(
4✔
54
                            ',',
4✔
55
                            $siteConfiguration['flux_content_types'] ?? '',
4✔
56
                            true
4✔
57
                        );
4✔
58
                    }
59
                } catch (SiteNotFoundException $exception) {
8✔
60
                    // Suppressed; sites not being found isn't a fatal problem here.
61
                }
62
                if (!empty($enabledContentTypes)) {
12✔
63
                    $fluidContentTypeNames = (array) $this->contentTypeManager->fetchContentTypeNames();
4✔
64
                    $currentItems = $result['processedTca']['columns']['CType']['config']['items'];
4✔
65
                    foreach ($currentItems as $index => $optionArray) {
4✔
66
                        $contentTypeName = $optionArray['value'] ?? $optionArray[1];
4✔
67
                        if (in_array($contentTypeName, $fluidContentTypeNames, true)
4✔
68
                            && !in_array($contentTypeName, $enabledContentTypes, true)
4✔
69
                        ) {
70
                            unset($result['processedTca']['columns']['CType']['config']['items'][$index]);
4✔
71
                        }
72
                    }
73
                }
74
            }
75
        }
76

77
        /** @var DataStructureProviderInterface[] $providers */
78
        $providers = $this->resolver->resolveConfigurationProviders(
16✔
79
            $result['tableName'],
16✔
80
            null,
16✔
81
            $result['databaseRow'],
16✔
82
            null,
16✔
83
            [DataStructureProviderInterface::class]
16✔
84
        );
16✔
85
        foreach ($providers as $provider) {
16✔
86
            $result = $provider->processTableConfiguration($result['databaseRow'], $result);
16✔
87
        }
88
        return $result;
16✔
89
    }
90
}
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