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

Yoast / Yoast-SEO-for-TYPO3 / 27813754449

19 Jun 2026 08:08AM UTC coverage: 11.724% (+0.03%) from 11.696%
27813754449

push

github

web-flow
Merge pull request #666 from BastiLu/main

[BUGFIX] Fix exception when editing records with sys_language_uid -1

1 of 2 new or added lines in 1 file covered. (50.0%)

321 of 2738 relevant lines covered (11.72%)

0.57 hits per line

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

91.3
/Classes/Service/SiteService.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 TYPO3\CMS\Core\Exception\SiteNotFoundException;
15
use TYPO3\CMS\Core\Site\Entity\Site;
16
use TYPO3\CMS\Core\Site\SiteFinder;
17

18
class SiteService
19
{
20
    /**
21
     * @var array<int, Site>
22
     */
23
    protected array $sites = [];
24

25
    public function __construct(
26
        protected SiteFinder $siteFinder
27
    ) {}
8✔
28

29
    public function getSiteByPageId(int $pageId): ?Site
30
    {
31
        if (isset($this->sites[$pageId])) {
8✔
32
            return $this->sites[$pageId];
1✔
33
        }
34

35
        try {
36
            $site = $this->siteFinder->getSiteByPageId($pageId);
8✔
37
            $this->sites[$pageId] = $site;
5✔
38
            return $site;
5✔
39
        } catch (SiteNotFoundException) {
3✔
40
            return null;
3✔
41
        }
42
    }
43

44
    public function getSiteRootPageId(int $pageUid): int
45
    {
46
        $site = $this->getSiteByPageId($pageUid);
2✔
47
        if ($site) {
2✔
48
            return $site->getRootPageId();
1✔
49
        }
50

51
        return 0;
1✔
52
    }
53

54
    public function getWebsiteTitle(int $pageUid, int $languageId): string
55
    {
56
        $site = $this->getSiteByPageId($pageUid);
3✔
57
        if (!$site) {
3✔
58
            return '';
1✔
59
        }
60

61
        if ($languageId === -1) {
2✔
NEW
62
            $languageId = $site->getDefaultLanguage()->getLanguageId();
×
63
        }
64

65
        $language = $site->getLanguageById($languageId);
2✔
66
        if (trim($language->getWebsiteTitle()) !== '') {
2✔
67
            return $language->getWebsiteTitle();
1✔
68
        }
69
        if (trim($site->getConfiguration()['websiteTitle'] ?? '') !== '') {
1✔
70
            return $site->getConfiguration()['websiteTitle'];
1✔
71
        }
72

73
        return '';
×
74
    }
75
}
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