OXIESEC PANEL
- Current Dir:
/
/
usr
/
share
/
php
/
Symfony
/
Component
/
Console
/
Helper
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
07/20/2024 06:32:21 AM
rwxr-xr-x
📄
DebugFormatterHelper.php
4.08 KB
03/05/2018 08:02:01 PM
rw-r--r--
📄
DescriptorHelper.php
2.55 KB
03/05/2018 08:02:01 PM
rw-r--r--
📄
FormatterHelper.php
2.89 KB
03/05/2018 08:02:01 PM
rw-r--r--
📄
Helper.php
3.72 KB
03/05/2018 08:02:01 PM
rw-r--r--
📄
HelperInterface.php
880 bytes
03/05/2018 08:02:01 PM
rw-r--r--
📄
HelperSet.php
2.45 KB
03/05/2018 08:02:01 PM
rw-r--r--
📄
InputAwareHelper.php
747 bytes
03/05/2018 08:02:01 PM
rw-r--r--
📄
ProcessHelper.php
4.74 KB
03/05/2018 08:02:01 PM
rw-r--r--
📄
ProgressBar.php
16.94 KB
03/05/2018 08:02:01 PM
rw-r--r--
📄
ProgressIndicator.php
7.76 KB
03/05/2018 08:02:01 PM
rw-r--r--
📄
QuestionHelper.php
14.27 KB
03/05/2018 08:02:01 PM
rw-r--r--
📄
SymfonyQuestionHelper.php
3.94 KB
03/05/2018 08:02:01 PM
rw-r--r--
📄
Table.php
19.67 KB
03/05/2018 08:02:01 PM
rw-r--r--
📄
TableCell.php
1.62 KB
03/05/2018 08:02:01 PM
rw-r--r--
📄
TableSeparator.php
536 bytes
03/05/2018 08:02:01 PM
rw-r--r--
📄
TableStyle.php
5.13 KB
03/05/2018 08:02:01 PM
rw-r--r--
Editing: ProcessHelper.php
Close
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Console\Helper; use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Process\Exception\ProcessFailedException; use Symfony\Component\Process\Process; /** * The ProcessHelper class provides helpers to run external processes. * * @author Fabien Potencier <fabien@symfony.com> */ class ProcessHelper extends Helper { /** * Runs an external process. * * @param OutputInterface $output An OutputInterface instance * @param string|array|Process $cmd An instance of Process or an array of arguments to escape and run or a command to run * @param string|null $error An error message that must be displayed if something went wrong * @param callable|null $callback A PHP callback to run whenever there is some * output available on STDOUT or STDERR * @param int $verbosity The threshold for verbosity * * @return Process The process that ran */ public function run(OutputInterface $output, $cmd, $error = null, callable $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE) { if ($output instanceof ConsoleOutputInterface) { $output = $output->getErrorOutput(); } $formatter = $this->getHelperSet()->get('debug_formatter'); if ($cmd instanceof Process) { $process = $cmd; } else { $process = new Process($cmd); } if ($verbosity <= $output->getVerbosity()) { $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine()))); } if ($output->isDebug()) { $callback = $this->wrapCallback($output, $process, $callback); } $process->run($callback); if ($verbosity <= $output->getVerbosity()) { $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode()); $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful())); } if (!$process->isSuccessful() && null !== $error) { $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error))); } return $process; } /** * Runs the process. * * This is identical to run() except that an exception is thrown if the process * exits with a non-zero exit code. * * @param OutputInterface $output An OutputInterface instance * @param string|Process $cmd An instance of Process or a command to run * @param string|null $error An error message that must be displayed if something went wrong * @param callable|null $callback A PHP callback to run whenever there is some * output available on STDOUT or STDERR * * @return Process The process that ran * * @throws ProcessFailedException * * @see run() */ public function mustRun(OutputInterface $output, $cmd, $error = null, callable $callback = null) { $process = $this->run($output, $cmd, $error, $callback); if (!$process->isSuccessful()) { throw new ProcessFailedException($process); } return $process; } /** * Wraps a Process callback to add debugging output. * * @param OutputInterface $output An OutputInterface interface * @param Process $process The Process * @param callable|null $callback A PHP callable * * @return callable */ public function wrapCallback(OutputInterface $output, Process $process, callable $callback = null) { if ($output instanceof ConsoleOutputInterface) { $output = $output->getErrorOutput(); } $formatter = $this->getHelperSet()->get('debug_formatter'); return function ($type, $buffer) use ($output, $process, $callback, $formatter) { $output->write($formatter->progress(spl_object_hash($process), $this->escapeString($buffer), Process::ERR === $type)); if (null !== $callback) { call_user_func($callback, $type, $buffer); } }; } private function escapeString($str) { return str_replace('<', '\\<', $str); } /** * {@inheritdoc} */ public function getName() { return 'process'; } }