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

tempestphp / tempest-framework / 14049246919

24 Mar 2025 09:42PM UTC coverage: 79.353% (-0.04%) from 79.391%
14049246919

push

github

web-flow
feat(support): support array parameters in string manipulations (#1073)

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

735 existing lines in 126 files now uncovered.

10492 of 13222 relevant lines covered (79.35%)

90.78 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
    ) {}
1✔
26

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

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

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

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

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

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

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

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

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

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