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

tempestphp / tempest-framework / 9045933531

11 May 2024 07:25PM UTC coverage: 86.566% (+0.3%) from 86.24%
9045933531

Pull #240

github

web-flow
Merge ef4f1596e into d6a8ae2f5
Pull Request #240: feat: Adds Timebox utility class and extends Clock

30 of 33 new or added lines in 4 files covered. (90.91%)

21 existing lines in 4 files now uncovered.

1321 of 1526 relevant lines covered (86.57%)

10.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Tempest.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest;
6

7
use Dotenv\Dotenv;
8
use Tempest\Application\HttpApplication;
9
use Tempest\Console\ConsoleApplication;
10
use Tempest\Console\ConsoleConfig;
11
use Tempest\Console\Exceptions\ConsoleExceptionHandler;
12
use Tempest\Discovery\DiscoveryLocation;
13
use Tempest\Exceptions\HttpExceptionHandler;
14

15
final readonly class Tempest
16
{
17
    private function __construct(
18
        private Kernel $kernel,
19
    ) {
20
    }
×
21

22
    public static function boot(string $root): self
23
    {
24
        $dotenv = Dotenv::createUnsafeImmutable($root);
×
25

26
        $dotenv->safeLoad();
×
27

28
        $appConfig = new AppConfig(
×
29
            root: $root,
×
30
            environment: Environment::from(env('ENVIRONMENT', Environment::LOCAL->value)),
×
31
            enableExceptionHandling: env('EXCEPTION_HANDLING', false),
×
32
            discoveryCache: env('DISCOVERY_CACHE', false),
×
33
        );
×
34

35
        if ($discoveryLocationsFromEnv = env('DISCOVERY_LOCATIONS')) {
×
36
            foreach (explode(',', $discoveryLocationsFromEnv) as $string) {
×
37
                [$namespace, $path] = explode(':', $string);
×
38

39
                $appConfig->discoveryLocations[] = new DiscoveryLocation($namespace, path($root, $path));
×
40
            }
41
        }
42

43
        $kernel = new Kernel(
×
44
            appConfig: $appConfig,
×
45
        );
×
46

47
        return new self(
×
48
            kernel: $kernel,
×
49
        );
×
50
    }
51

52
    public function console(): ConsoleApplication
53
    {
54
        $container = $this->kernel->init();
×
55
        $appConfig = $container->get(AppConfig::class);
×
56

57
        $application = $container->get(ConsoleApplication::class);
×
58

59
        // Application-specific config
60
        $consoleConfig = $container->get(ConsoleConfig::class);
×
61
        $consoleConfig->name = 'Tempest';
×
62

63
        $appConfig->exceptionHandlers[] = $container->get(ConsoleExceptionHandler::class);
×
64

65
        return $application;
×
66
    }
67

68
    public function http(): HttpApplication
69
    {
UNCOV
70
        $container = $this->kernel->init();
×
UNCOV
71
        $appConfig = $container->get(AppConfig::class);
×
72

73
        $application = new HttpApplication(
×
UNCOV
74
            container: $container,
×
75
            appConfig: $appConfig,
×
76
        );
×
77

78
        $container->singleton(Application::class, fn () => $application);
×
79

80
        $appConfig->exceptionHandlers[] = $container->get(HttpExceptionHandler::class);
×
81

82
        return $application;
×
83
    }
84

85
    public function kernel(): Kernel
86
    {
UNCOV
87
        return $this->kernel;
×
88
    }
89
}
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