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

tempestphp / tempest-framework / 11799155234

12 Nov 2024 02:19PM UTC coverage: 82.551% (+0.1%) from 82.455%
11799155234

Pull #714

github

web-flow
Merge 0e4d40a29 into d599d5047
Pull Request #714: feat(routing): add regex chunking to route regex

71 of 73 new or added lines in 5 files covered. (97.26%)

19 existing lines in 2 files now uncovered.

7333 of 8883 relevant lines covered (82.55%)

49.18 hits per line

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

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

3
declare(strict_types=1);
4

5
namespace Tempest\Http;
6

7
use Tempest\Container\Container;
8
use Tempest\Container\Singleton;
9
use Tempest\Core\AppConfig;
10
use Tempest\Core\Application;
11
use Tempest\Core\Kernel;
12
use Tempest\Core\Tempest;
13
use function Tempest\env;
14
use Tempest\Http\Session\Session;
15
use Tempest\Log\Channels\AppendLogChannel;
16
use Tempest\Log\LogConfig;
17
use Tempest\Support\PathHelper;
18
use Throwable;
19

20
#[Singleton]
21
final readonly class HttpApplication implements Application
22
{
23
    public function __construct(private Container $container)
×
24
    {
25
    }
×
26

27
    /** @param \Tempest\Core\DiscoveryLocation[] $discoveryLocations */
28
    public static function boot(
×
29
        string $root,
30
        array $discoveryLocations = [],
31
    ): self {
32
        $container = Tempest::boot($root, $discoveryLocations);
×
33

34
        $application = $container->get(HttpApplication::class);
×
35

36
        // Application-specific setup
37
        $logConfig = $container->get(LogConfig::class);
×
38

39
        if (
40
            $logConfig->debugLogPath === null
×
UNCOV
41
            && $logConfig->serverLogPath === null
×
42
            && $logConfig->channels === []
×
43
        ) {
UNCOV
44
            $logConfig->debugLogPath = PathHelper::make($container->get(Kernel::class)->root, '/log/debug.log');
×
45
            $logConfig->serverLogPath = env('SERVER_LOG');
×
UNCOV
46
            $logConfig->channels[] = new AppendLogChannel(PathHelper::make($root, '/log/tempest.log'));
×
47
        }
48

UNCOV
49
        return $application;
×
50
    }
51

52
    public function run(): void
×
53
    {
54
        try {
55
            $router = $this->container->get(Router::class);
×
56

UNCOV
57
            $psrRequest = (new RequestFactory())->make();
×
58

UNCOV
59
            $responseSender = $this->container->get(ResponseSender::class);
×
60

61
            $responseSender->send(
×
62
                $router->dispatch($psrRequest),
×
63
            );
×
64

UNCOV
65
            $this->container->get(Session::class)->cleanup();
×
66

UNCOV
67
            $this->container->get(Kernel::class)->shutdown();
×
UNCOV
68
        } catch (Throwable $throwable) {
×
UNCOV
69
            foreach ($this->container->get(AppConfig::class)->errorHandlers as $exceptionHandler) {
×
UNCOV
70
                $exceptionHandler->handleException($throwable);
×
71
            }
72

UNCOV
73
            throw $throwable;
×
74
        }
75
    }
76
}
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