diff options
author | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
---|---|---|
committer | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
commit | bf6655a534a6775d30cafa67bd801276bda1d98d (patch) | |
tree | c6381e3f6c81c33eab72508f410b165ba05f7e9c /vendor/symfony/console/Debug/CliRequest.php | |
parent | 94d67a4b51f8e62e7d518cce26a526ae1ec48278 (diff) | |
download | AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.zip |
VERSION 0.2 doctrine ORM et entités
Diffstat (limited to 'vendor/symfony/console/Debug/CliRequest.php')
-rw-r--r-- | vendor/symfony/console/Debug/CliRequest.php | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/vendor/symfony/console/Debug/CliRequest.php b/vendor/symfony/console/Debug/CliRequest.php new file mode 100644 index 0000000..b023db0 --- /dev/null +++ b/vendor/symfony/console/Debug/CliRequest.php | |||
@@ -0,0 +1,70 @@ | |||
1 | <?php | ||
2 | |||
3 | /* | ||
4 | * This file is part of the Symfony package. | ||
5 | * | ||
6 | * (c) Fabien Potencier <fabien@symfony.com> | ||
7 | * | ||
8 | * For the full copyright and license information, please view the LICENSE | ||
9 | * file that was distributed with this source code. | ||
10 | */ | ||
11 | |||
12 | namespace Symfony\Component\Console\Debug; | ||
13 | |||
14 | use Symfony\Component\Console\Command\TraceableCommand; | ||
15 | use Symfony\Component\HttpFoundation\Request; | ||
16 | use Symfony\Component\HttpFoundation\Response; | ||
17 | |||
18 | /** | ||
19 | * @internal | ||
20 | */ | ||
21 | final class CliRequest extends Request | ||
22 | { | ||
23 | public function __construct( | ||
24 | public readonly TraceableCommand $command, | ||
25 | ) { | ||
26 | parent::__construct( | ||
27 | attributes: ['_controller' => \get_class($command->command), '_virtual_type' => 'command'], | ||
28 | server: $_SERVER, | ||
29 | ); | ||
30 | } | ||
31 | |||
32 | // Methods below allow to populate a profile, thus enable search and filtering | ||
33 | public function getUri(): string | ||
34 | { | ||
35 | if ($this->server->has('SYMFONY_CLI_BINARY_NAME')) { | ||
36 | $binary = $this->server->get('SYMFONY_CLI_BINARY_NAME').' console'; | ||
37 | } else { | ||
38 | $binary = $this->server->get('argv')[0]; | ||
39 | } | ||
40 | |||
41 | return $binary.' '.$this->command->input; | ||
42 | } | ||
43 | |||
44 | public function getMethod(): string | ||
45 | { | ||
46 | return $this->command->isInteractive ? 'INTERACTIVE' : 'BATCH'; | ||
47 | } | ||
48 | |||
49 | public function getResponse(): Response | ||
50 | { | ||
51 | return new class($this->command->exitCode) extends Response { | ||
52 | public function __construct(private readonly int $exitCode) | ||
53 | { | ||
54 | parent::__construct(); | ||
55 | } | ||
56 | |||
57 | public function getStatusCode(): int | ||
58 | { | ||
59 | return $this->exitCode; | ||
60 | } | ||
61 | }; | ||
62 | } | ||
63 | |||
64 | public function getClientIp(): string | ||
65 | { | ||
66 | $application = $this->command->getApplication(); | ||
67 | |||
68 | return $application->getName().' '.$application->getVersion(); | ||
69 | } | ||
70 | } | ||