• 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

93.94
/src/Tempest/Core/src/Commands/DiscoveryStatusCommand.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\Core\Commands;
6

7
use Tempest\Cache\DiscoveryCacheStrategy;
8
use Tempest\Console\Console;
9
use Tempest\Console\ConsoleArgument;
10
use Tempest\Console\ConsoleCommand;
11
use Tempest\Core\DiscoveryCache;
12
use Tempest\Core\Kernel;
13

14
use function Tempest\root_path;
15
use function Tempest\Support\str;
16

17
final readonly class DiscoveryStatusCommand
18
{
19
    public function __construct(
1✔
20
        private Console $console,
21
        private Kernel $kernel,
22
        private DiscoveryCache $discoveryCache,
23
    ) {
24
    }
1✔
25

26
    #[ConsoleCommand(name: 'discovery:status', description: 'Lists all discovery locations and discovery classes')]
1✔
27
    public function __invoke(
28
        #[ConsoleArgument(description: 'Prints discovery classes', aliases: ['c'])]
29
        bool $showClasses = false,
30
        #[ConsoleArgument(description: 'Prints discovery locations', aliases: ['l'])]
31
        bool $showLocations = false,
32
    ): void {
33
        $this->console->header('Discovery status');
1✔
34
        $this->console->keyValue('Registered locations', (string) count($this->kernel->discoveryLocations));
1✔
35
        $this->console->keyValue('Loaded discovery classes', (string) count($this->kernel->discoveryClasses));
1✔
36
        $this->console->keyValue('Cache', match ($this->discoveryCache->isEnabled()) {
1✔
37
            true => '<style="fg-green bold">ENABLED</style>',
1✔
38
            false => '<style="fg-gray bold">DISABLED</style>',
1✔
39
        });
1✔
40
        $this->console->keyValue('Cache strategy', match ($this->discoveryCache->getStrategy()) {
1✔
41
            DiscoveryCacheStrategy::FULL => '<style="fg-green bold">FULL</style>',
1✔
UNCOV
42
            DiscoveryCacheStrategy::PARTIAL => '<style="fg-blue bold">PARTIAL</style>',
×
UNCOV
43
            DiscoveryCacheStrategy::NONE => '<style="fg-gray bold">NO CACHING</style>',
×
44
            DiscoveryCacheStrategy::INVALID => '<style="fg-red bold">INVALID</style>',
1✔
45
        });
1✔
46
        $this->console->keyValue('Cache validity', match ($this->discoveryCache->isValid()) {
1✔
47
            true => '<style="fg-blue bold">OK</style>',
1✔
48
            false => '<style="fg-red bold">CORRUPTED</style>',
1✔
49
        });
1✔
50

51
        if ($showClasses) {
1✔
52
            $this->console->header('Discovery classes', subheader: 'These classes are used by Tempest to determine which classes to discover and how to handle them.');
1✔
53
            $this->console->writeln();
1✔
54

55
            foreach ($this->kernel->discoveryClasses as $discoveryClass) {
1✔
56
                $this->console->keyValue("<style='fg-gray'>{$discoveryClass}</style>");
1✔
57
            }
58
        }
59

60
        if ($showLocations) {
1✔
61
            $this->console->header('Discovery locations', subheader: 'These locations are used by Tempest to discover classes.');
1✔
62
            $this->console->writeln();
1✔
63

64
            foreach ($this->kernel->discoveryLocations as $discoveryLocation) {
1✔
65
                $path = str(realpath($discoveryLocation->path))
1✔
66
                    ->replaceStart(root_path(), '.')
1✔
67
                    ->toString();
1✔
68

69
                $this->console->keyValue("<style='fg-gray'>{$path}</style>");
1✔
70
            }
71
        }
72
    }
73
}
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