ILIAS
release_5-2 Revision v5.2.25-18-g3f80b828510
◀ ilDoc Overview
InputStream.php
Go to the documentation of this file.
1
<?
php
2
3
/*
4
* This file is part of the Symfony package.
5
*
6
* (c) Fabien Potencier <fabien@symfony.com>
7
*
8
* For the full copyright and license information, please view the LICENSE
9
* file that was distributed with this source code.
10
*/
11
12
namespace
Symfony\Component\Process
;
13
14
use
Symfony\Component\Process\Exception\RuntimeException
;
15
21
class
InputStream
implements
\IteratorAggregate
22
{
23
private
$onEmpty
= null;
24
private
$input
=
array
();
25
private
$open
=
true
;
26
30
public
function
onEmpty
(callable
$onEmpty
= null)
31
{
32
$this->
onEmpty
=
$onEmpty
;
33
}
34
40
public
function
write
(
$input
)
41
{
42
if
(null ===
$input
) {
43
return
;
44
}
45
if
($this->
isClosed
()) {
46
throw
new
RuntimeException
(sprintf(
'%s is closed'
, static::class));
47
}
48
$this->
input
[] =
ProcessUtils::validateInput
(__METHOD__,
$input
);
49
}
50
54
public
function
close
()
55
{
56
$this->open =
false
;
57
}
58
62
public
function
isClosed
()
63
{
64
return
!
$this->open
;
65
}
66
67
public
function
getIterator
()
68
{
69
$this->open =
true
;
70
71
while
($this->open || $this->
input
) {
72
if
(!$this->
input
) {
73
yield
''
;
74
continue
;
75
}
76
$current = array_shift($this->
input
);
77
78
if
($current instanceof \
Iterator
) {
79
foreach
($current as $cur) {
80
yield $cur;
81
}
82
}
else
{
83
yield $current;
84
}
85
if
(!$this->
input
&& $this->open && null !==
$onEmpty
= $this->
onEmpty
) {
86
$this->
write
(
$onEmpty
($this));
87
}
88
}
89
}
90
}
Symfony\Component\Process\InputStream\$input
$input
Definition:
InputStream.php:24
Symfony\Component\Process\InputStream\write
write($input)
Appends an input to the write buffer.
Definition:
InputStream.php:40
Symfony\Component\Process\InputStream\$open
$open
Definition:
InputStream.php:25
Symfony\Component\Process\InputStream
Provides a way to continuously write to the input of a Process until the InputStream is closed...
Definition:
InputStream.php:21
input
input
Definition:
langcheck.php:166
RuntimeException
Symfony\Component\Process\InputStream\onEmpty
onEmpty(callable $onEmpty=null)
Sets a callback that is called when the write buffer becomes empty.
Definition:
InputStream.php:30
Symfony\Component\Process\ProcessUtils\validateInput
static validateInput($caller, $input)
Validates and normalizes a Process input.
Definition:
ProcessUtils.php:87
array
Create styles array
The data for the language used.
Definition:
40duplicateStyle.php:19
Iterator
Symfony\Component\Process
Symfony\Component\Process\InputStream\isClosed
isClosed()
Tells whether the write buffer is closed or not.
Definition:
InputStream.php:62
Symfony\Component\Process\InputStream\$onEmpty
$onEmpty
Definition:
InputStream.php:23
php
RuntimeException
Symfony\Component\Process\InputStream\close
close()
Closes the write buffer.
Definition:
InputStream.php:54
Symfony\Component\Process\InputStream\getIterator
getIterator()
Definition:
InputStream.php:67
libs
composer
vendor
symfony
process
InputStream.php
Generated on Fri Jan 17 2025 19:00:55 for ILIAS by
1.8.13 (using
Doxyfile
)