public __construct ( string $command, string $cwd = '', array $env = [], array $options = [] ) | ||
$command | string | Command to run. |
$cwd | string | Working directory or use an empty string to use the working directory of the current PHP process. |
$env | array | Environment variables or use an empty array to inherit from the current PHP process. |
$options | array | Options for proc_open(). |
public function __construct(string $command, string $cwd = '', array $env = [], array $options = [])
{
$this->command = $command;
if ('' !== $cwd) {
$this->cwd = $cwd;
}
foreach ($env as $key => $value) {
if (!is_array($value)) {
// $env cannot accept array values.
$this->env[(string) $key] = (string) $value;
}
}
$this->options = $options;
}