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

tempestphp / tempest-framework / 14024978163

23 Mar 2025 05:55PM UTC coverage: 79.391% (-0.05%) from 79.441%
14024978163

push

github

web-flow
feat(view): cache Blade and Twig templates in internal storage (#1061)

2 of 2 new or added lines in 2 files covered. (100.0%)

912 existing lines in 110 files now uncovered.

10478 of 13198 relevant lines covered (79.39%)

91.09 hits per line

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

11.11
/src/Tempest/CommandBus/src/AsyncCommandRepositories/FileCommandRepository.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\CommandBus\AsyncCommandRepositories;
6

7
use Tempest\CommandBus\CommandRepository;
8
use Tempest\CommandBus\Exceptions\CouldNotResolveCommand;
9

10
use function Tempest\Support\arr;
11

12
final readonly class FileCommandRepository implements CommandRepository
13
{
14
    public function store(string $uuid, object $command): void
2✔
15
    {
16
        $payload = serialize($command);
2✔
17

18
        file_put_contents(__DIR__ . "/../stored-commands/{$uuid}.pending.txt", $payload);
2✔
19
    }
20

UNCOV
21
    public function findPendingCommand(string $uuid): object
×
22
    {
UNCOV
23
        $path = __DIR__ . "/../stored-commands/{$uuid}.pending.txt";
×
24

25
        if (! file_exists($path)) {
×
UNCOV
26
            throw new CouldNotResolveCommand($uuid);
×
27
        }
28

UNCOV
29
        $payload = file_get_contents($path);
×
30

UNCOV
31
        return unserialize($payload);
×
32
    }
33

UNCOV
34
    public function markAsDone(string $uuid): void
×
35
    {
UNCOV
36
        $path = __DIR__ . "/../stored-commands/{$uuid}.pending.txt";
×
37

UNCOV
38
        unlink($path);
×
39
    }
40

UNCOV
41
    public function markAsFailed(string $uuid): void
×
42
    {
43
        if (! is_file(__DIR__ . "/../stored-commands/{$uuid}.pending.txt")) {
×
44
            return;
×
45
        }
46

UNCOV
47
        rename(
×
48
            from: __DIR__ . "/../stored-commands/{$uuid}.pending.txt",
×
UNCOV
49
            to: __DIR__ . "/../stored-commands/{$uuid}.failed.txt",
×
50
        );
×
51
    }
52

UNCOV
53
    public function getPendingCommands(): array
×
54
    {
UNCOV
55
        return arr(glob(__DIR__ . '/../stored-commands/*.pending.txt'))
×
56
            ->mapWithKeys(function (string $path) {
×
57
                $uuid = str_replace('.pending.txt', '', pathinfo($path, PATHINFO_BASENAME));
×
58
                $payload = file_get_contents($path);
×
59

UNCOV
60
                yield $uuid => unserialize($payload);
×
UNCOV
61
            })
×
UNCOV
62
            ->toArray();
×
63
    }
64
}
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