/** * Appends an input to the write buffer. * * @param resource|scalar|\Traversable|null The input to append as stream resource, scalar or \Traversable */ public function write($input) { if (null === $input) { return; } if ($this->isClosed()) { throw new RuntimeException(sprintf('%s is closed', static::class)); } $this->input[] = ProcessUtils::validateInput(__METHOD__, $input); }
/** * Sets the contents of STDIN. * * @param string|null $stdin The new contents * * @return self The current Process instance * * @throws LogicException In case the process is running * @throws InvalidArgumentException In case the argument is invalid */ public function setStdin($stdin) { if ($this->isRunning()) { throw new LogicException('STDIN can not be set while the process is running.'); } $this->stdin = ProcessUtils::validateInput(sprintf('%s::%s', __CLASS__, __FUNCTION__), $stdin); return $this; }
/** * Sets the input of the process. * * @param string|null $input The input as a string * * @return ProcessBuilder * * @throws InvalidArgumentException In case the argument is invalid */ public function setInput($input) { $this->input = ProcessUtils::validateInput(sprintf('%s::%s', __CLASS__, __FUNCTION__), $input); return $this; }
/** * Sets the input of the process. * * @param mixed $input The input as a string * * @return ProcessBuilder * * @throws InvalidArgumentException In case the argument is invalid */ public function setInput($input) { $this->input = ProcessUtils::validateInput(__METHOD__, $input); return $this; }
/** * Sets the input. * * This content will be passed to the underlying process standard input. * * @param resource|scalar|\Traversable|null $input The content * * @return self The current Process instance * * @throws LogicException In case the process is running */ public function setInput($input) { if ($this->isRunning()) { throw new LogicException('Input can not be set while the process is running.'); } $this->input = ProcessUtils::validateInput(__METHOD__, $input); return $this; }