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

Yoast / Yoast-SEO-for-TYPO3 / 13016412721

28 Jan 2025 05:47PM UTC coverage: 1.05% (-0.001%) from 1.051%
13016412721

push

github

RinyVT
[BUGFIX] Optimized code of TypoScriptStructuredDataProvider

0 of 13 new or added lines in 1 file covered. (0.0%)

28 of 2666 relevant lines covered (1.05%)

0.03 hits per line

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

0.0
/Classes/StructuredData/TypoScriptStructuredDataProvider.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace YoastSeoForTypo3\YoastSeo\StructuredData;
6

7
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
8
use TYPO3\CMS\Core\Site\SiteFinder;
9
use TYPO3\CMS\Core\TypoScript\TypoScriptService;
10
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
11

12
class TypoScriptStructuredDataProvider implements StructuredDataProviderInterface
13
{
14
    public function __construct(
15
        protected SiteFinder $siteFinder,
16
        protected PageRepository $pageRepository,
17
        protected TypoScriptService $typoScriptService,
18
    ) {}
×
19

20
    /**
21
     * @return array<int, array<int|string, mixed>>
22
     */
23
    public function getData(): array
24
    {
25
        $data = [];
×
26

27
        foreach (
NEW
28
            $this->getTypoScriptFrontendController()->config['config']['structuredData.']['data.'] ?? [] as $dataConfig
×
29
        ) {
NEW
30
            if (!isset($dataConfig['type'], $dataConfig['context'])) {
×
NEW
31
                continue;
×
32
            }
33

NEW
34
            $item = [];
×
NEW
35
            $config = $this->typoScriptService->convertTypoScriptArrayToPlainArray($dataConfig);
×
36

NEW
37
            foreach ($config as $key => $value) {
×
NEW
38
                $cObject = $key . '.';
×
NEW
39
                if (isset($dataConfig[$cObject])) {
×
NEW
40
                    $value = $this->getTypoScriptFrontendController()->cObj->stdWrap((string)$key, $dataConfig[$cObject]);
×
41
                }
NEW
42
                $key = in_array($key, ['type', 'context']) ? '@' . $key : $key;
×
43

NEW
44
                $item[$key] = $value;
×
45
            }
NEW
46
            $data[] = $item;
×
47
        }
48

NEW
49
        return $data;
×
50
    }
51

52
    protected function getTypoScriptFrontendController(): TypoScriptFrontendController
53
    {
54
        return $GLOBALS['TSFE'];
×
55
    }
56
}
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