|
1 | 1 | #!/usr/bin/env php
|
2 | 2 | <?php
|
3 | 3 |
|
4 |
| -/* |
5 |
| - * This file is part of the Symfony package. |
6 |
| - * |
7 |
| - * (c) Fabien Potencier <[email protected]> |
8 |
| - * |
9 |
| - * For the full copyright and license information, please view the LICENSE |
10 |
| - * file that was distributed with this source code. |
11 |
| - */ |
12 |
| - |
13 | 4 | /**
|
14 |
| - * Starts a dump server to collect and output dumps on a single place with multiple formats support. |
| 5 | + * Proxy PHP file generated by Composer |
15 | 6 | *
|
16 |
| - * @author Maxime Steinhausser <[email protected]> |
| 7 | + * This file includes the referenced bin path (../symfony/var-dumper/Resources/bin/var-dump-server) using eval to remove the shebang if present |
| 8 | + * |
| 9 | + * @generated |
17 | 10 | */
|
18 | 11 |
|
19 |
| -use Psr\Log\LoggerInterface; |
20 |
| -use Symfony\Component\Console\Application; |
21 |
| -use Symfony\Component\Console\Input\ArgvInput; |
22 |
| -use Symfony\Component\Console\Input\InputOption; |
23 |
| -use Symfony\Component\Console\Logger\ConsoleLogger; |
24 |
| -use Symfony\Component\Console\Output\ConsoleOutput; |
25 |
| -use Symfony\Component\VarDumper\Command\ServerDumpCommand; |
26 |
| -use Symfony\Component\VarDumper\Server\DumpServer; |
27 |
| - |
28 |
| -function includeIfExists(string $file): bool |
29 |
| -{ |
30 |
| - return file_exists($file) && include $file; |
31 |
| -} |
32 |
| - |
33 |
| -if ( |
34 |
| - !includeIfExists(__DIR__ . '/../../../../autoload.php') && |
35 |
| - !includeIfExists(__DIR__ . '/../../vendor/autoload.php') && |
36 |
| - !includeIfExists(__DIR__ . '/../../../../../../vendor/autoload.php') |
37 |
| -) { |
38 |
| - fwrite(STDERR, 'Install dependencies using Composer.'.PHP_EOL); |
39 |
| - exit(1); |
40 |
| -} |
41 |
| - |
42 |
| -if (!class_exists(Application::class)) { |
43 |
| - fwrite(STDERR, 'You need the "symfony/console" component in order to run the VarDumper server.'.PHP_EOL); |
44 |
| - exit(1); |
| 12 | +$binPath = realpath(__DIR__ . "/" . '../symfony/var-dumper/Resources/bin/var-dump-server'); |
| 13 | +$contents = file_get_contents($binPath); |
| 14 | +$contents = preg_replace('{^#!/.+\r?\n<\?(php)?}', '', $contents, 1, $replaced); |
| 15 | +if ($replaced) { |
| 16 | + $contents = strtr($contents, array( |
| 17 | + '__FILE__' => var_export($binPath, true), |
| 18 | + '__DIR__' => var_export(dirname($binPath), true), |
| 19 | + )); |
| 20 | + |
| 21 | + eval($contents); |
| 22 | + exit(0); |
45 | 23 | }
|
46 |
| - |
47 |
| -$input = new ArgvInput(); |
48 |
| -$output = new ConsoleOutput(); |
49 |
| -$defaultHost = '127.0.0.1:9912'; |
50 |
| -$host = $input->getParameterOption(['--host'], $_SERVER['VAR_DUMPER_SERVER'] ?? $defaultHost, true); |
51 |
| -$logger = interface_exists(LoggerInterface::class) ? new ConsoleLogger($output->getErrorOutput()) : null; |
52 |
| - |
53 |
| -$app = new Application(); |
54 |
| - |
55 |
| -$app->getDefinition()->addOption( |
56 |
| - new InputOption('--host', null, InputOption::VALUE_REQUIRED, 'The address the server should listen to', $defaultHost) |
57 |
| -); |
58 |
| - |
59 |
| -$app->add($command = new ServerDumpCommand(new DumpServer($host, $logger))) |
60 |
| - ->getApplication() |
61 |
| - ->setDefaultCommand($command->getName(), true) |
62 |
| - ->run($input, $output) |
63 |
| -; |
| 24 | +include $binPath; |
0 commit comments