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

tempestphp / tempest-framework / 11874665672

16 Nov 2024 12:30PM UTC coverage: 82.07% (+0.01%) from 82.06%
11874665672

push

github

web-flow
feat(http): add `Put` and `Patch` attributes (#742)

12 of 12 new or added lines in 2 files covered. (100.0%)

22 existing lines in 2 files now uncovered.

7836 of 9548 relevant lines covered (82.07%)

51.94 hits per line

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

8.7
/src/Tempest/Console/src/ConsoleApplication.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Tempest\Console;
6

7
use Tempest\Console\Actions\ExecuteConsoleCommand;
8
use Tempest\Console\Input\ConsoleArgumentBag;
9
use Tempest\Container\Container;
10
use Tempest\Core\AppConfig;
11
use Tempest\Core\Application;
12
use Tempest\Core\Kernel;
13
use Tempest\Core\Tempest;
14
use Tempest\Log\Channels\AppendLogChannel;
15
use Tempest\Log\LogConfig;
16
use Tempest\Support\PathHelper;
17
use Throwable;
18

19
final readonly class ConsoleApplication implements Application
20
{
21
    public function __construct(
4✔
22
        private Container $container,
23
        private AppConfig $appConfig,
24
        private ConsoleArgumentBag $argumentBag,
25
    ) {
26
    }
4✔
27

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

36
        $application = $container->get(ConsoleApplication::class);
×
37

38
        // Application-specific config
39
        $consoleConfig = $container->get(ConsoleConfig::class);
×
40
        $consoleConfig->name = $name;
×
41

42
        $logConfig = $container->get(LogConfig::class);
×
43

44
        if (
45
            $logConfig->debugLogPath === null
×
46
            && $logConfig->channels === []
×
47
        ) {
48
            $logConfig->debugLogPath = PathHelper::make($container->get(Kernel::class)->root, '/log/debug.log');
×
49
            $logConfig->channels[] = new AppendLogChannel(PathHelper::make($container->get(Kernel::class)->root, '/log/tempest.log'));
×
50
        }
51

52
        return $application;
×
53
    }
54

55
    public function run(): void
×
56
    {
57
        try {
58
            $exitCode = ($this->container->get(ExecuteConsoleCommand::class))($this->argumentBag->getCommandName());
×
59

60
            $exitCode = is_int($exitCode) ? $exitCode : $exitCode->value;
×
61

62
            if ($exitCode < 0 || $exitCode > 255) {
×
63
                throw new InvalidExitCode($exitCode);
×
64
            }
65

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

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