function InputStream::getIterator
File
-
vendor/
symfony/ process/ InputStream.php, line 70
Class
- InputStream
- Provides a way to continuously write to the input of a Process until the InputStream is closed.
Namespace
Symfony\Component\ProcessCode
public function getIterator() : \Traversable {
$this->open = true;
while ($this->open || $this->input) {
if (!$this->input) {
(yield '');
continue;
}
$current = array_shift($this->input);
if ($current instanceof \Iterator) {
yield from $current;
}
else {
(yield $current);
}
if (!$this->input && $this->open && null !== ($onEmpty = $this->onEmpty)) {
$this->write($onEmpty($this));
}
}
}