Lines Matching defs:env

58     private $env = [];
137 * @param array|null $env The environment variables or null to use the same environment as the current PHP process
143 public function __construct(array $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
159 if (null !== $env) {
160 $this->setEnv($env);
184 * @param array|null $env The environment variables or null to use the same environment as the current PHP process
192 public static function fromShellCommandline(string $command, string $cwd = null, array $env = null, $input = null, ?float $timeout = 60)
194 $process = new static([], $cwd, $env, $input, $timeout);
250 public function run(callable $callback = null, array $env = []): int
252 $this->start($callback, $env);
269 public function mustRun(callable $callback = null, array $env = []): self
271 if (0 !== $this->run($callback, $env)) {
297 public function start(callable $callback = null, array $env = [])
309 if ($this->env) {
310 $env += '\\' === \DIRECTORY_SEPARATOR ? array_diff_ukey($this->env, $env, 'strcasecmp') : $this->env;
313 $env += '\\' === \DIRECTORY_SEPARATOR ? array_diff_ukey($this->getDefaultEnv(), $env, 'strcasecmp') : $this->getDefaultEnv();
323 $commandline = $this->replacePlaceholders($commandline, $env);
327 $commandline = $this->prepareWindowsCommandLine($commandline, $env);
342 foreach ($env as $k => $v) {
388 public function restart(callable $callback = null, array $env = []): self
395 $process->start($callback, $env);
1138 return $this->env;
1144 * @param array<string|\Stringable> $env The new environment variables
1148 public function setEnv(array $env)
1150 $this->env = $env;
1542 private function prepareWindowsCommandLine(string $cmd, array &$env): string
1555 function ($m) use (&$env, &$varCache, &$varCount, $uid) {
1573 $env[$var] = $value;
1634 private function replacePlaceholders(string $commandline, array $env)
1636 return preg_replace_callback('/"\$\{:([_a-zA-Z]++[_a-zA-Z0-9]*+)\}"/', function ($matches) use ($commandline, $env) {
1637 if (!isset($env[$matches[1]]) || false === $env[$matches[1]]) {
1641 return $this->escapeArgument($env[$matches[1]]);
1647 $env = getenv();
1648 $env = ('\\' === \DIRECTORY_SEPARATOR ? array_intersect_ukey($env, $_SERVER, 'strcasecmp') : array_intersect_key($env, $_SERVER)) ?: $env;
1650 return $_ENV + ('\\' === \DIRECTORY_SEPARATOR ? array_diff_ukey($env, $_ENV, 'strcasecmp') : $env);