[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 #!/usr/bin/env php 2 <?php 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 /** 14 * Starts a dump server to collect and output dumps on a single place with multiple formats support. 15 * 16 * @author Maxime Steinhausser <[email protected]> 17 */ 18 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); 45 } 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 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |