Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/process/PhpProcess.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
14 use Symfony\Component\Process\Exception\RuntimeException; | 14 use Symfony\Component\Process\Exception\RuntimeException; |
15 | 15 |
16 /** | 16 /** |
17 * PhpProcess runs a PHP script in an independent process. | 17 * PhpProcess runs a PHP script in an independent process. |
18 * | 18 * |
19 * $p = new PhpProcess('<?php echo "foo"; ?>'); | 19 * $p = new PhpProcess('<?php echo "foo"; ?>'); |
20 * $p->run(); | 20 * $p->run(); |
21 * print $p->getOutput()."\n"; | 21 * print $p->getOutput()."\n"; |
22 * | 22 * |
23 * @author Fabien Potencier <fabien@symfony.com> | 23 * @author Fabien Potencier <fabien@symfony.com> |
24 */ | 24 */ |
25 class PhpProcess extends Process | 25 class PhpProcess extends Process |
26 { | 26 { |
35 { | 35 { |
36 $executableFinder = new PhpExecutableFinder(); | 36 $executableFinder = new PhpExecutableFinder(); |
37 if (false === $php = $executableFinder->find(false)) { | 37 if (false === $php = $executableFinder->find(false)) { |
38 $php = null; | 38 $php = null; |
39 } else { | 39 } else { |
40 $php = array_merge(array($php), $executableFinder->findArguments()); | 40 $php = array_merge([$php], $executableFinder->findArguments()); |
41 } | 41 } |
42 if ('phpdbg' === PHP_SAPI) { | 42 if ('phpdbg' === \PHP_SAPI) { |
43 $file = tempnam(sys_get_temp_dir(), 'dbg'); | 43 $file = tempnam(sys_get_temp_dir(), 'dbg'); |
44 file_put_contents($file, $script); | 44 file_put_contents($file, $script); |
45 register_shutdown_function('unlink', $file); | 45 register_shutdown_function('unlink', $file); |
46 $php[] = $file; | 46 $php[] = $file; |
47 $script = null; | 47 $script = null; |
62 } | 62 } |
63 | 63 |
64 /** | 64 /** |
65 * {@inheritdoc} | 65 * {@inheritdoc} |
66 */ | 66 */ |
67 public function start(callable $callback = null/*, array $env = array()*/) | 67 public function start(callable $callback = null/*, array $env = []*/) |
68 { | 68 { |
69 if (null === $this->getCommandLine()) { | 69 if (null === $this->getCommandLine()) { |
70 throw new RuntimeException('Unable to find the PHP executable.'); | 70 throw new RuntimeException('Unable to find the PHP executable.'); |
71 } | 71 } |
72 $env = 1 < func_num_args() ? func_get_arg(1) : null; | 72 $env = 1 < \func_num_args() ? func_get_arg(1) : null; |
73 | 73 |
74 parent::start($callback, $env); | 74 parent::start($callback, $env); |
75 } | 75 } |
76 } | 76 } |