function readline in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/guzzlehttp/psr7/src/functions.php \GuzzleHttp\Psr7\readline()
 
Read a line from the stream up to the maximum allowed buffer length
Parameters
StreamInterface $stream Stream to read from:
int $maxLength Maximum buffer length:
Return value
string|bool
1 string reference to 'readline'
- Shell::__construct in vendor/
symfony/ console/ Shell.php  - Constructor.
 
File
- vendor/
guzzlehttp/ psr7/ src/ functions.php, line 413  
Namespace
GuzzleHttp\Psr7Code
function readline(StreamInterface $stream, $maxLength = null) {
  $buffer = '';
  $size = 0;
  while (!$stream
    ->eof()) {
    // Using a loose equality here to match on '' and false.
    if (null == ($byte = $stream
      ->read(1))) {
      return $buffer;
    }
    $buffer .= $byte;
    // Break when a new line is found or the max length - 1 is reached
    if ($byte == PHP_EOL || ++$size == $maxLength - 1) {
      break;
    }
  }
  return $buffer;
}