• 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

58.33
/src/Tempest/CommandBus/src/HandleAsyncCommand.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\CommandBus;
6

7
use Tempest\Console\Console;
8
use Tempest\Console\ConsoleCommand;
9
use Tempest\Console\ExitCode;
10
use Tempest\Console\HasConsole;
11
use Tempest\Container\Container;
12
use Throwable;
13

14
use function Tempest\Support\arr;
15

16
final readonly class HandleAsyncCommand
17
{
18
    use HasConsole;
19

20
    public function __construct(
1✔
21
        private CommandBusConfig $commandBusConfig,
22
        private Container $container,
23
        private Console $console,
24
        private CommandRepository $repository,
25
    ) {
26
    }
1✔
27

28
    #[ConsoleCommand(name: 'command:handle', description: 'Manually executes a pending command')]
1✔
29
    public function __invoke(?string $uuid = null): ExitCode
30
    {
31
        try {
32
            if ($uuid) {
1✔
33
                $command = $this->repository->findPendingCommand($uuid);
1✔
34
            } else {
UNCOV
35
                $command = arr($this->repository->getPendingCommands())->first();
×
36
            }
37

38
            if (! $command) {
1✔
UNCOV
39
                $this->error('No pending command found.');
×
40

UNCOV
41
                return ExitCode::ERROR;
×
42
            }
43

44
            $commandHandler = $this->commandBusConfig->handlers[$command::class] ?? null;
1✔
45

46
            if (! $commandHandler) {
1✔
47
                $commandClass = $command::class;
×
UNCOV
48
                $this->error("No handler found for command {$commandClass}.");
×
49

UNCOV
50
                return ExitCode::ERROR;
×
51
            }
52

53
            $commandHandler->handler->invokeArgs(
1✔
54
                $this->container->get($commandHandler->handler->getDeclaringClass()->getName()),
1✔
55
                [$command],
1✔
56
            );
1✔
57

58
            $this->repository->markAsDone($uuid);
1✔
59

60
            return ExitCode::SUCCESS;
1✔
61
        } catch (Throwable $throwable) {
×
62
            $this->repository->markAsFailed($uuid);
×
63
            $this->error($throwable->getMessage());
×
64

65
            return ExitCode::ERROR;
×
66
        }
67
    }
68
}
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