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

Yoast / Yoast-SEO-for-TYPO3 / 21521134747

30 Jan 2026 03:30PM UTC coverage: 0.866% (-0.4%) from 1.275%
21521134747

push

github

RinyVT
[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

0 of 550 new or added lines in 53 files covered. (0.0%)

33 existing lines in 21 files now uncovered.

23 of 2657 relevant lines covered (0.87%)

0.03 hits per line

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

0.0
/Classes/Service/SaveScoresService.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;
13

14
use Doctrine\DBAL\Exception;
15
use TYPO3\CMS\Core\Database\Connection;
16
use TYPO3\CMS\Core\Database\ConnectionPool;
17
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
18

19
class SaveScoresService
20
{
21
    public function __construct(
22
        protected ConnectionPool $connectionPool
NEW
23
    ) {}
×
24

25
    /**
26
     * @param array<string, string> $data
27
     */
28
    public function save(array $data): void
29
    {
30
        try {
NEW
31
            $record = $this->getRecord($data);
×
NEW
32
        } catch (\Exception) {
×
NEW
33
            return;
×
34
        }
35

NEW
36
        if ($record === null || !isset($data['readabilityScore'], $data['seoScore'])) {
×
NEW
37
            return;
×
38
        }
39

NEW
40
        $connection = $this->connectionPool->getConnectionForTable($data['table']);
×
NEW
41
        $connection->update($data['table'], [
×
NEW
42
            'tx_yoastseo_score_readability' => (string)$data['readabilityScore'],
×
NEW
43
            'tx_yoastseo_score_seo' => (string)$data['seoScore'],
×
NEW
44
        ], ['uid' => (int)$record['uid']]);
×
45
    }
46

47
    /**
48
     * @param array<string, string> $data
49
     * @return array<string, int|string>|null
50
     * @throws Exception
51
     */
52
    protected function getRecord(array $data): ?array
53
    {
NEW
54
        if ($data['table'] === 'pages') {
×
NEW
55
            return $this->getPageRecord((int)$data['uid'], (int)($data['languageId'] ?? 0));
×
56
        }
57

NEW
58
        $connection = $this->connectionPool->getConnectionForTable($data['table']);
×
NEW
59
        $record = $connection->select(
×
NEW
60
            ['uid'],
×
NEW
61
            $data['table'],
×
NEW
62
            ['uid' => (int)$data['uid']],
×
NEW
63
        )->fetchAssociative();
×
NEW
64
        return $record === false ? null : $record;
×
65
    }
66

67
    /**
68
     * @return array<string, int|string>|null
69
     * @throws Exception
70
     */
71
    protected function getPageRecord(int $pageUid, int $languageId): ?array
72
    {
NEW
73
        $queryBuilder = $this->connectionPool->getQueryBuilderForTable('pages');
×
NEW
74
        $queryBuilder->getRestrictions()->removeAll()->add(new DeletedRestriction());
×
NEW
75
        $queryBuilder->select('uid')->from('pages');
×
NEW
76
        if ($languageId > 0) {
×
NEW
77
            $queryBuilder->where(
×
NEW
78
                $queryBuilder->expr()->and(
×
NEW
79
                    $queryBuilder->expr()->eq(
×
NEW
80
                        $GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField'],
×
NEW
81
                        $queryBuilder->createNamedParameter($pageUid, Connection::PARAM_INT)
×
NEW
82
                    ),
×
NEW
83
                    $queryBuilder->expr()->eq(
×
NEW
84
                        $GLOBALS['TCA']['pages']['ctrl']['languageField'],
×
NEW
85
                        $queryBuilder->createNamedParameter($languageId, Connection::PARAM_INT)
×
NEW
86
                    )
×
NEW
87
                )
×
NEW
88
            );
×
89
        } else {
NEW
90
            $queryBuilder->where(
×
NEW
91
                $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($pageUid, Connection::PARAM_INT))
×
NEW
92
            );
×
93
        }
NEW
94
        $record = $queryBuilder->executeQuery()->fetchAssociative();
×
NEW
95
        return $record === false ? null : $record;
×
96
    }
97
}
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