• Модуль: mail
  • Путь к файлу: ~/bitrix/modules/mail/lib/imap.php
  • Класс: BitrixMailImap
  • Вызов: Imap::readLine
protected function readLine()
{
	$line = '';

	while (!feof($this->stream))
	{
		$buffer = @fgets($this->stream, 4096);
		if ($buffer === false)
			break;

		$meta = $this->options['timeout'] > 0
			? stream_get_meta_data($this->stream)
			: array('timed_out' => false);

		$line .= $buffer;

		$eolRegex = '/ (? { (? d+ ) } )? rn $ /x';
		if (preg_match($eolRegex, $line, $matches))
		{
			if (empty($matches['literal']))
				break;

			if ($meta['timed_out'])
				return false;

			$data = $this->readBytes($matches['bytes']);
			if ($data === false)
				return false;

			$line .= $data;
		}

		if ($meta['timed_out'])
			break;
	}

	if (!preg_match('/rn$/', $line, $matches))
	{
		$this->reset();
		return false;
	}

	if(($this->logLevel & self::LOG_LEVEL_READ))
	{
		$this->writeToLog($line);
	}

	return $line;
}