Lines Matching refs:input
26 private $input;
31 * @param resource|string|int|float|bool|\Iterator|null $input
33 public function __construct($input)
35 if (\is_resource($input) || $input instanceof \Iterator) {
36 $this->input = $input;
37 } elseif (\is_string($input)) {
38 $this->inputBuffer = $input;
40 $this->inputBuffer = (string) $input;
81 if (\is_resource($this->input)) {
82 stream_set_blocking($this->input, 0);
89 * Writes input to stdin.
91 * @throws InvalidArgumentException When an input iterator yields a non supported value
98 $input = $this->input;
100 if ($input instanceof \Iterator) {
101 if (!$input->valid()) {
102 $input = null;
103 } elseif (\is_resource($input = $input->current())) {
104 stream_set_blocking($input, 0);
106 if (!\is_string($input)) {
107 if (!is_scalar($input)) {
108 throw new InvalidArgumentException(sprintf('"%s" yielded a value of type "%s", but only scalars and stream resources are supported.', get_debug_type($this->input), get_debug_type($input)));
110 $input = (string) $input;
112 $this->inputBuffer = $input;
113 $this->input->next();
114 $input = null;
116 $input = null;
137 if ($input) {
139 $data = fread($input, self::CHUNK_SIZE);
151 if (feof($input)) {
152 if ($this->input instanceof \Iterator) {
153 $this->input->next();
155 $this->input = null;
161 // no input to read on resource, buffer is empty
162 if (!isset($this->inputBuffer[0]) && !($this->input instanceof \Iterator ? $this->input->valid() : $this->input)) {
163 $this->input = null;