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

php-bug-catcher / bug-catcher / 10983482928

22 Sep 2024 06:33PM UTC coverage: 77.225% (+0.4%) from 76.842%
10983482928

push

github

tito10047
better test coverage

3 of 3 new or added lines in 1 file covered. (100.0%)

4 existing lines in 1 file now uncovered.

807 of 1045 relevant lines covered (77.22%)

11.43 hits per line

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

73.68
/src/Service/DashboardImportance.php
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Jozef Môstka
5
 * Date: 26. 7. 2024
6
 * Time: 22:28
7
 */
8
namespace BugCatcher\Service;
9

10
use JetBrains\PhpStorm\ArrayShape;
11
use BugCatcher\Entity\Notifier;
12
use BugCatcher\Enum\Importance;
13
use Symfony\Component\DependencyInjection\Attribute\Autowire;
14

15
final class DashboardImportance
16
{
17

18
        public array $importance = [];
19

20
        public function __construct(
21
                #[Autowire(param: 'kernel.cache_dir')]
22
                private readonly string $cacheDir
23
        ) {}
9✔
24

25
        public function upgradeHigher(string $group, Importance $importance, Notifier $notifier): void {
26
                $current = $this->importance[$group]??[
5✔
27
                        "importance" => $importance,
5✔
28
                        "notifier"   => $notifier,
5✔
29
                ];
30
        if ($importance->isHigherThan($current["importance"])) {
5✔
UNCOV
31
                        $current = [
×
UNCOV
32
                                "importance" => $importance,
×
UNCOV
33
                                "notifier"   => $notifier,
×
UNCOV
34
                        ];
×
35
                }
36
                $this->importance[$group] = $current;
5✔
37
        }
38

39
        public function save(string $group): void {
40
                $importance = $this->importance[$group]??null;
5✔
41
                if ($importance === null) {
5✔
42
                        return;
×
43
                }
44
                $group = substr(md5($group), 0, 8);
5✔
45
                file_put_contents($this->cacheDir . "/importance-$group.txt", serialize($importance));
5✔
46
        }
47

48
        #[ArrayShape(['importance' => "BugCatcher\Enum\Importance", 'notifier' => "BugCatcher\Entity\Notifier"])]
49
        public function load(string $group): ?array {
50
                $group = substr(md5($group), 0, 8);
6✔
51
                if (!file_exists($this->cacheDir . "/importance-$group.txt")) {
6✔
52
                        return ["importance" => null, "notifier" => null];
1✔
53
                }
54

55
                return unserialize(file_get_contents($this->cacheDir . "/importance-$group.txt"));
5✔
56
        }
57
}
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