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

eliashaeussler / typo3-warming / 18445843960

12 Oct 2025 03:21PM UTC coverage: 92.263% (-0.5%) from 92.803%
18445843960

Pull #993

github

eliashaeussler
[FEATURE] Extract context menu actions into separate classes
Pull Request #993: [FEATURE] Extract context menu actions into separate classes

124 of 141 new or added lines in 6 files covered. (87.94%)

1 existing line in 1 file now uncovered.

1753 of 1900 relevant lines covered (92.26%)

12.24 hits per line

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

70.83
/Classes/Backend/Action/SiteWarmupActions.php
1
<?php
2

3
declare(strict_types=1);
4

5
/*
6
 * This file is part of the TYPO3 CMS extension "warming".
7
 *
8
 * Copyright (C) 2021-2025 Elias Häußler <elias@haeussler.dev>
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation, either version 2 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22
 */
23

24
namespace EliasHaeussler\Typo3Warming\Backend\Action;
25

26
use EliasHaeussler\Typo3Warming\Configuration;
27
use TYPO3\CMS\Core;
28

29
/**
30
 * SiteWarmupActions
31
 *
32
 * @author Elias Häußler <elias@haeussler.dev>
33
 * @license GPL-2.0-or-later
34
 *
35
 * @implements \IteratorAggregate<WarmupAction>
36
 */
37
final readonly class SiteWarmupActions implements \Countable, \IteratorAggregate
38
{
39
    /**
40
     * @param Core\Site\Entity\SiteLanguage[] $siteLanguages
41
     */
42
    public function __construct(
10✔
43
        public Core\Site\Entity\Site $site,
44
        public array $siteLanguages,
45
    ) {}
10✔
46

47
    /**
48
     * @return \Generator<WarmupAction>
49
     */
50
    public function getActions(): \Generator
8✔
51
    {
52
        if ($this->hasSelectAction()) {
8✔
53
            yield WarmupAction::special(
6✔
54
                'select',
6✔
55
                Configuration\Localization::translate('cacheWarmupAction.context.site.select'),
6✔
56
                'flags-multiple',
6✔
57
            );
6✔
58
        }
59

60
        foreach ($this->siteLanguages as $siteLanguage) {
8✔
61
            yield WarmupAction::language(
8✔
62
                $siteLanguage->getLanguageId(),
8✔
63
                $siteLanguage->getTitle(),
8✔
64
                $siteLanguage->getFlagIdentifier(),
8✔
65
            );
8✔
66
        }
67

68
        yield from [];
69
    }
70

NEW
71
    public function count(): int
×
72
    {
NEW
73
        $count = \count($this->siteLanguages);
×
74

NEW
75
        if ($this->hasSelectAction()) {
×
NEW
76
            $count++;
×
77
        }
78

NEW
79
        return $count;
×
80
    }
81

NEW
82
    public function getIterator(): \Generator
×
83
    {
NEW
84
        yield from $this->getActions();
×
85
    }
86

87
    private function hasSelectAction(): bool
8✔
88
    {
89
        return \count($this->siteLanguages) > 1;
8✔
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

© 2025 Coveralls, Inc