• 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

60.0
/src/Tempest/Core/src/Commands/InstallCommand.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\Core\Commands;
6

7
use Tempest\Console\Console;
8
use Tempest\Console\ConsoleCommand;
9
use Tempest\Console\HasConsole;
10
use Tempest\Console\Middleware\ForceMiddleware;
11
use Tempest\Container\Container;
12
use Tempest\Core\Installer;
13
use Tempest\Core\InstallerConfig;
14

15
use function Tempest\Support\arr;
16

17
final readonly class InstallCommand
18
{
19
    use HasConsole;
20

21
    public function __construct(
6✔
22
        private InstallerConfig $installerConfig,
23
        private Console $console,
24
        private Container $container,
25
    ) {}
6✔
26

27
    #[ConsoleCommand(name: 'install', description: 'Applies the specified installer', middleware: [ForceMiddleware::class])]
6✔
28
    public function __invoke(?string $installer = null): void
29
    {
30
        $installer = $this->resolveInstaller($installer);
6✔
31

32
        if ($installer === null) {
6✔
UNCOV
33
            $this->error('Installer not found');
×
34

UNCOV
35
            return;
×
36
        }
37

38
        if (! $this->confirm("Running the <em>{$installer->name}</em> installer, continue?", default: true)) {
6✔
UNCOV
39
            $this->error('Aborted.');
×
40

UNCOV
41
            return;
×
42
        }
43

44
        $installer->install();
5✔
45
    }
46

47
    private function resolveInstaller(?string $search): ?Installer
6✔
48
    {
49
        /** @var Installer[]|\Tempest\Support\Arr\ImmutableArray $installers */
50
        $installers = arr($this->installerConfig->installers)
6✔
51
            ->map(fn (string $installerClass) => $this->container->get($installerClass));
6✔
52

53
        if (! $search) {
6✔
UNCOV
54
            $search = $this->ask(
×
55
                question: 'Please choose an installer',
×
56
                options: $installers->mapWithKeys(fn (Installer $installer) => yield $installer::class => $installer->name)->toArray(),
×
57
            );
×
58
        }
59

60
        return $installers->first(fn (Installer $installer) => $installer::class === $search || $installer->name === $search);
6✔
61
    }
62
}
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