Mercurial > hg > cmmr2012-drupal-site
comparison vendor/symfony/process/ProcessBuilder.php @ 4:a9cd425dd02b
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:11:55 +0000 |
parents | c75dbcec494b |
children |
comparison
equal
deleted
inserted
replaced
3:307d7a7fd348 | 4:a9cd425dd02b |
---|---|
23 */ | 23 */ |
24 class ProcessBuilder | 24 class ProcessBuilder |
25 { | 25 { |
26 private $arguments; | 26 private $arguments; |
27 private $cwd; | 27 private $cwd; |
28 private $env = array(); | 28 private $env = []; |
29 private $input; | 29 private $input; |
30 private $timeout = 60; | 30 private $timeout = 60; |
31 private $options; | 31 private $options; |
32 private $inheritEnv = true; | 32 private $inheritEnv = true; |
33 private $prefix = array(); | 33 private $prefix = []; |
34 private $outputDisabled = false; | 34 private $outputDisabled = false; |
35 | 35 |
36 /** | 36 /** |
37 * @param string[] $arguments An array of arguments | 37 * @param string[] $arguments An array of arguments |
38 */ | 38 */ |
39 public function __construct(array $arguments = array()) | 39 public function __construct(array $arguments = []) |
40 { | 40 { |
41 $this->arguments = $arguments; | 41 $this->arguments = $arguments; |
42 } | 42 } |
43 | 43 |
44 /** | 44 /** |
46 * | 46 * |
47 * @param string[] $arguments An array of arguments | 47 * @param string[] $arguments An array of arguments |
48 * | 48 * |
49 * @return static | 49 * @return static |
50 */ | 50 */ |
51 public static function create(array $arguments = array()) | 51 public static function create(array $arguments = []) |
52 { | 52 { |
53 return new static($arguments); | 53 return new static($arguments); |
54 } | 54 } |
55 | 55 |
56 /** | 56 /** |
76 * | 76 * |
77 * @return $this | 77 * @return $this |
78 */ | 78 */ |
79 public function setPrefix($prefix) | 79 public function setPrefix($prefix) |
80 { | 80 { |
81 $this->prefix = is_array($prefix) ? $prefix : array($prefix); | 81 $this->prefix = \is_array($prefix) ? $prefix : [$prefix]; |
82 | 82 |
83 return $this; | 83 return $this; |
84 } | 84 } |
85 | 85 |
86 /** | 86 /** |
101 } | 101 } |
102 | 102 |
103 /** | 103 /** |
104 * Sets the working directory. | 104 * Sets the working directory. |
105 * | 105 * |
106 * @param null|string $cwd The working directory | 106 * @param string|null $cwd The working directory |
107 * | 107 * |
108 * @return $this | 108 * @return $this |
109 */ | 109 */ |
110 public function setWorkingDirectory($cwd) | 110 public function setWorkingDirectory($cwd) |
111 { | 111 { |
133 * | 133 * |
134 * Setting a variable overrides its previous value. Use `null` to unset a | 134 * Setting a variable overrides its previous value. Use `null` to unset a |
135 * defined environment variable. | 135 * defined environment variable. |
136 * | 136 * |
137 * @param string $name The variable name | 137 * @param string $name The variable name |
138 * @param null|string $value The variable value | 138 * @param string|null $value The variable value |
139 * | 139 * |
140 * @return $this | 140 * @return $this |
141 */ | 141 */ |
142 public function setEnv($name, $value) | 142 public function setEnv($name, $value) |
143 { | 143 { |
256 * | 256 * |
257 * @throws LogicException In case no arguments have been provided | 257 * @throws LogicException In case no arguments have been provided |
258 */ | 258 */ |
259 public function getProcess() | 259 public function getProcess() |
260 { | 260 { |
261 if (0 === count($this->prefix) && 0 === count($this->arguments)) { | 261 if (0 === \count($this->prefix) && 0 === \count($this->arguments)) { |
262 throw new LogicException('You must add() command arguments before calling getProcess().'); | 262 throw new LogicException('You must add() command arguments before calling getProcess().'); |
263 } | 263 } |
264 | 264 |
265 $arguments = array_merge($this->prefix, $this->arguments); | 265 $arguments = array_merge($this->prefix, $this->arguments); |
266 $process = new Process($arguments, $this->cwd, $this->env, $this->input, $this->timeout, $this->options); | 266 $process = new Process($arguments, $this->cwd, $this->env, $this->input, $this->timeout, $this->options); |