• 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

95.45
/Classes/Backend/BackendLayoutDataProvider.php
1
<?php
2
namespace FluidTYPO3\Flux\Backend;
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\Provider\PageProvider;
12
use FluidTYPO3\Flux\Provider\ProviderInterface;
13
use FluidTYPO3\Flux\Provider\ProviderResolver;
14
use FluidTYPO3\Flux\Proxy\DataProviderContextProxy;
15
use FluidTYPO3\Flux\Service\WorkspacesAwareRecordService;
16
use TYPO3\CMS\Backend\View\BackendLayout\BackendLayout;
17
use TYPO3\CMS\Backend\View\BackendLayout\BackendLayoutCollection;
18
use TYPO3\CMS\Backend\View\BackendLayout\DataProviderContext;
19
use TYPO3\CMS\Backend\View\BackendLayout\DataProviderInterface;
20

21
class BackendLayoutDataProvider implements DataProviderInterface
22
{
23
    protected ProviderResolver $providerResolver;
24
    protected WorkspacesAwareRecordService $recordService;
25

26
    public function __construct(ProviderResolver $providerResolver, WorkspacesAwareRecordService $recordService)
27
    {
28
        $this->providerResolver = $providerResolver;
20✔
29
        $this->recordService = $recordService;
20✔
30
    }
31

32
    public function getIdentifier(): string
33
    {
34
        return 'flux';
×
35
    }
36

37
    public function addBackendLayouts(
38
        DataProviderContext $dataProviderContext,
39
        BackendLayoutCollection $backendLayoutCollection
40
    ): void {
41
        $backendLayout = $this->getBackendLayout(
4✔
42
            'grid',
4✔
43
            DataProviderContextProxy::readPageUidFromObject($dataProviderContext)
4✔
44
        );
4✔
45
        if ($backendLayout) {
4✔
46
            $backendLayoutCollection->add($backendLayout);
4✔
47
        }
48
    }
49

50
    /**
51
     * Gets a backend layout by (regular) identifier.
52
     *
53
     * @param string $identifier
54
     * @param integer $pageId
55
     */
56
    public function getBackendLayout($identifier, $pageId): ?BackendLayout
57
    {
58
        $emptyLayout = $this->createBackendLayoutInstance($identifier, 'Empty', '');
20✔
59
        $record = $this->recordService->getSingle('pages', '*', $pageId);
20✔
60
        if (null === $record) {
20✔
61
            return $emptyLayout;
8✔
62
        }
63
        $provider = $this->resolveProvider($record);
12✔
64
        if (!$provider instanceof PageProvider) {
12✔
65
            return $emptyLayout;
8✔
66
        }
67
        $grid = $provider->getGrid($record);
4✔
68
        return $grid->buildBackendLayout(0);
4✔
69
    }
70

71
    protected function resolveProvider(array $record): ?ProviderInterface
72
    {
73
        $record = $this->recordService->getSingle('pages', '*', $record['uid']);
12✔
74

75
        // Stop processing if no template configured in rootline
76
        if (null === $record) {
12✔
77
            return null;
4✔
78
        }
79

80
        return $this->providerResolver->resolvePageProvider($record);
8✔
81
    }
82

83
    /**
84
     * @param string|array $configuration
85
     * @codeCoverageIgnore
86
     */
87
    protected function createBackendLayoutInstance(string $identifier, string $title, $configuration): BackendLayout
88
    {
89
        return new BackendLayout($identifier, 'Empty', '');
90
    }
91
}
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