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

Yoast / Yoast-SEO-for-TYPO3 / 24723291290

21 Apr 2026 12:50PM UTC coverage: 10.457% (+9.2%) from 1.275%
24723291290

push

github

web-flow
Merge pull request #632 from Yoast/feature/yoast-v12

[FEATURE] Version 12.0.0, added v14 support, removed v11 support including php8.0 and php8.1, rewrote backend javascript functionality to typescript and webcomponents

40 of 806 new or added lines in 69 files covered. (4.96%)

40 existing lines in 23 files now uncovered.

284 of 2716 relevant lines covered (10.46%)

0.29 hits per line

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

0.0
/Classes/Service/Overview/OverviewService.php
1
<?php
2

3
/**
4
 * This file is part of the "yoast_seo" extension for TYPO3 CMS.
5
 *
6
 * For the full copyright and license information, please read the
7
 * LICENSE.txt file that was distributed with this source code.
8
 */
9

10
declare(strict_types=1);
11

12
namespace YoastSeoForTypo3\YoastSeo\Service\Overview;
13

14
use TYPO3\CMS\Backend\Utility\BackendUtility;
15
use TYPO3\CMS\Core\Pagination\ArrayPaginator;
16
use TYPO3\CMS\Core\Pagination\SlidingWindowPagination;
17
use TYPO3\CMS\Core\Type\Bitmask\Permission;
18
use TYPO3\CMS\Extbase\Mvc\RequestInterface;
19
use YoastSeoForTypo3\YoastSeo\Constants\TableNames;
20
use YoastSeoForTypo3\YoastSeo\Controller\OverviewController;
21
use YoastSeoForTypo3\YoastSeo\DataProviders\OverviewDataProviderInterface;
22
use YoastSeoForTypo3\YoastSeo\Service\Overview\Dto\DataProviderRequest;
23
use YoastSeoForTypo3\YoastSeo\Service\Overview\Dto\OverviewData;
24
use YoastSeoForTypo3\YoastSeo\Traits\BackendUserTrait;
25

26
class OverviewService
27
{
28
    use BackendUserTrait;
29

30
    /** @var array<string, OverviewDataProviderInterface> */
31
    protected array $filters;
32

33
    /**
34
     * @param iterable<string, OverviewDataProviderInterface> $filters
35
     */
36
    public function __construct(
37
        iterable $filters
38
    ) {
39
        foreach ($filters as $key => $dataProvider) {
×
40
            $this->addFilter($key, $dataProvider);
×
41
        }
42
    }
43

44
    public function getOverviewData(RequestInterface $request, int $currentPage, int $itemsPerPage): OverviewData
45
    {
46
        $overviewData = new OverviewData($this->getPageInformation($request));
×
47
        if (empty($overviewData->getPageInformation())) {
×
48
            return $overviewData;
×
49
        }
50

51
        $overviewData->setFilters($this->getAvailableFilters($request));
×
52
        if (empty($overviewData->getFilters())) {
×
53
            return $overviewData;
×
54
        }
55

56
        $activeFilter = $this->getActiveFilter($request);
×
57
        $items = $activeFilter->process();
×
58

NEW
59
        $arrayPaginator = new ArrayPaginator(
×
NEW
60
            $items,
×
NEW
61
            $currentPage,
×
NEW
62
            $itemsPerPage
×
NEW
63
        );
×
64

65
        return $overviewData->setItems($items)
×
66
            ->setPaginator($arrayPaginator)
×
NEW
67
            ->setPagination(new SlidingWindowPagination($arrayPaginator, 15))
×
68
            ->setActiveFilter($activeFilter)
×
69
            ->setParams($this->getDataProviderRequest($request));
×
70
    }
71

72
    /**
73
     * @return array<string, OverviewDataProviderInterface>|null
74
     */
75
    public function getAvailableFilters(RequestInterface $request): ?array
76
    {
77
        if ($this->filters === []) {
×
78
            return null;
×
79
        }
80

81
        $dataProviderRequest = $this->getDataProviderRequest($request);
×
82
        foreach ($this->filters as $dataProvider) {
×
83
            $dataProvider->initialize($dataProviderRequest);
×
84
        }
85

86
        return $this->filters;
×
87
    }
88

89
    protected function getActiveFilter(RequestInterface $request): OverviewDataProviderInterface
90
    {
91
        if ($this->filters === []) {
×
92
            throw new \RuntimeException('No filters available');
×
93
        }
94

95
        if ($request->hasArgument('filter')) {
×
96
            $activeFilter = $request->getArgument('filter');
×
97
            if (is_string($activeFilter) && isset($this->filters[$activeFilter])) {
×
98
                return $this->filters[$activeFilter];
×
99
            }
100
        }
101

102
        return current($this->filters);
×
103
    }
104

105
    protected function getDataProviderRequest(RequestInterface $request): DataProviderRequest
106
    {
107
        return new DataProviderRequest(
×
108
            (int)($request->getQueryParams()['id'] ?? 0),
×
109
            (int)($request->getQueryParams()[OverviewController::REQUEST_ARGUMENT]['language'] ?? $request->getQueryParams()['language'] ?? 0),
×
NEW
110
            TableNames::PAGES
×
111
        );
×
112
    }
113

114
    /**
115
     * @return array<string, string|int>
116
     */
117
    protected function getPageInformation(RequestInterface $request): array
118
    {
119
        $id = (int)($request->getQueryParams()['id'] ?? 0);
×
120
        if ($id === 0) {
×
121
            return [];
×
122
        }
123
        $pageInformation = BackendUtility::readPageAccess(
×
124
            $id,
×
125
            $this->getBackendUser()->getPagePermsClause(Permission::PAGE_SHOW)
×
126
        );
×
127
        return is_array($pageInformation) ? $pageInformation : [];
×
128
    }
129

130
    protected function addFilter(string $key, OverviewDataProviderInterface $dataProvider): void
131
    {
132
        $this->filters[$key] = $dataProvider;
×
133
    }
134
}
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