• 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

18.52
/src/Tempest/Console/src/Middleware/HelpMiddleware.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\Console\Middleware;
6

7
use Tempest\Console\Actions\RenderConsoleCommand;
8
use Tempest\Console\Console;
9
use Tempest\Console\ConsoleCommand;
10
use Tempest\Console\ConsoleMiddleware;
11
use Tempest\Console\ConsoleMiddlewareCallable;
12
use Tempest\Console\ExitCode;
13
use Tempest\Console\Initializers\Invocation;
14

15
final readonly class HelpMiddleware implements ConsoleMiddleware
16
{
17
    public function __construct(
99✔
18
        private Console $console,
19
    ) {
20
    }
99✔
21

22
    public function __invoke(Invocation $invocation, ConsoleMiddlewareCallable $next): ExitCode|int
99✔
23
    {
24
        if ($invocation->argumentBag->get('-h') || $invocation->argumentBag->get('help')) {
99✔
25
            $this->renderHelp($invocation->consoleCommand);
×
26

27
            return ExitCode::SUCCESS;
×
28
        }
29

30
        return $next($invocation);
99✔
31
    }
32

33
    private function renderHelp(ConsoleCommand $consoleCommand): void
×
34
    {
35
        $this->console->header(
×
36
            header: $consoleCommand->getName(),
×
37
            subheader: $consoleCommand->description,
×
UNCOV
38
        );
×
39

UNCOV
40
        $this->console->header('Usage');
×
41
        (new RenderConsoleCommand($this->console, renderArguments: true, renderDescription: false))($consoleCommand);
×
42

43
        if ($consoleCommand->help) {
×
44
            $this->console->writeln();
×
45
            $this->console->writeln('<style="fg-gray">' . $consoleCommand->help . '</style>');
×
46
        }
47

UNCOV
48
        foreach ($consoleCommand->getArgumentDefinitions() as $argumentDefinition) {
×
UNCOV
49
            if ($argumentDefinition->aliases === [] && ! $argumentDefinition->description && ! $argumentDefinition->help) {
×
50
                continue;
×
51
            }
52

UNCOV
53
            $this->console
×
UNCOV
54
                ->writeln()
×
UNCOV
55
                ->write("<style=\"underline\">{$argumentDefinition->name}</style>")
×
UNCOV
56
                ->when($argumentDefinition->aliases !== [], fn (Console $console) => $console->write(' (' . implode(', ', $argumentDefinition->aliases) . ')'))
×
UNCOV
57
                ->when($argumentDefinition->description, fn (Console $console) => $console->writeln()->writeln($argumentDefinition->description))
×
UNCOV
58
                ->when($argumentDefinition->help, fn (Console $console) => $console->writeln()->writeln('<style="fg-gray">' . $argumentDefinition->help . '</style>'));
×
59
        }
60

UNCOV
61
        $this->console->writeln();
×
62
    }
63
}
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