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

eliashaeussler / typo3-warming / 18040892543

26 Sep 2025 02:36PM UTC coverage: 92.759% (+0.2%) from 92.569%
18040892543

push

github

web-flow
[TASK] Update stylelint-copyright to v3.9.1

| datasource | package             | from  | to    |
| ---------- | ------------------- | ----- | ----- |
| npm        | stylelint-copyright | 3.9.0 | 3.9.1 |

1691 of 1823 relevant lines covered (92.76%)

12.26 hits per line

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

95.65
/Classes/Enums/WarmupState.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\Enums;
25

26
use EliasHaeussler\CacheWarmup;
27
use EliasHaeussler\Typo3Warming\Result;
28
use Psr\Log;
29

30
/**
31
 * WarmupState
32
 *
33
 * @author Elias Häußler <elias@haeussler.dev>
34
 * @license GPL-2.0-or-later
35
 */
36
enum WarmupState: string
37
{
38
    case Failed = 'failed';
39
    case Success = 'success';
40
    case Unknown = 'unknown';
41
    case Warning = 'warning';
42

43
    /**
44
     * @phpstan-param Log\LogLevel::* $level
45
     */
46
    public static function fromLogLevel(string $level): self
8✔
47
    {
48
        if (CacheWarmup\Log\LogLevel::satisfies(Log\LogLevel::ERROR, $level)) {
8✔
49
            return self::Failed;
4✔
50
        }
51

52
        if (CacheWarmup\Log\LogLevel::satisfies(Log\LogLevel::WARNING, $level)) {
4✔
53
            return self::Warning;
1✔
54
        }
55

56
        if (CacheWarmup\Log\LogLevel::satisfies(Log\LogLevel::INFO, $level)) {
3✔
57
            return self::Success;
2✔
58
        }
59

60
        return self::Unknown;
1✔
61
    }
62

63
    public static function fromCacheWarmupResult(Result\CacheWarmupResult $result): self
13✔
64
    {
65
        return self::fromCrawlingResults(
13✔
66
            $result->getResult()->getSuccessful(),
13✔
67
            $result->getResult()->getFailed(),
13✔
68
        );
13✔
69
    }
70

71
    /**
72
     * @param list<CacheWarmup\Result\CrawlingResult> $successful
73
     * @param list<CacheWarmup\Result\CrawlingResult> $failed
74
     */
75
    public static function fromCrawlingResults(array $successful, array $failed): self
17✔
76
    {
77
        $successfulCount = \count($successful);
17✔
78
        $failedCount = \count($failed);
17✔
79

80
        if ($failedCount > 0 && $successfulCount === 0) {
17✔
81
            return self::Failed;
11✔
82
        }
83

84
        if ($failedCount > 0 && $successfulCount > 0) {
6✔
85
            return self::Warning;
2✔
86
        }
87

88
        if ($failedCount === 0) {
4✔
89
            return self::Success;
4✔
90
        }
91

92
        return self::Unknown;
×
93
    }
94
}
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