Returns one line of data from the stream.

The returned line will have linebreaks removed if the $trim option is set.

@throws ezcMailTransportConnection
if there is no valid connection
@param bool $trim
@return string
185854
public function getLine( $trim = false )
    {
        $data = '';
        $line = '';

        if ( is_resource( $this->connection ) )
        {
            // in case there is a problem with the connection fgets() returns false
            while ( strpos( $data, self::CRLF ) === false )
            {
                $line = fgets( $this->connection, 512 );

                /* If the mail server aborts the connection, fgets() will
                 * return false. We need to throw an exception here to prevent
                 * the calling code from looping indefinitely. */
                if ( $line === false )
                {
                    $this->connection = null;
                    throw new ezcMailTransportException( 'Could not read from the stream. It was probably terminated by the host.' );
                }

                $data .= $line;
            }

            if ( $trim == false )
            {
                return $data;
            }
            else
            {
                return rtrim( $data, "\r\n" );
            }
        }
        throw new ezcMailTransportException( 'Could not read from the stream. It was probably terminated by the host.' );
    }
472564
public function getBuffer($trim = "", $tolower = false)
		{
		$r = $this->buffer;
		if ($trim)
			{
			$r = trim($r, " \t\n\r\0\x0B" . $trim);
			}
		if ($tolower)
			{
			$r = strtolower($r);
			}
		return $r;
		}
959431
public function read($delim = '#')
    {
        $file = file_get_contents($this->file);

        $delim = preg_quote($delim);
        if (preg_match("/#\s$delim\s(.*?)\s#\s\\\\$delim/s", $file, $matches)) {
            return trim($matches[1]);
        } else {
            return false;
        }
    }
727669
protected function readLine()
    {
        if (! $this->valid()) {
            throw new Error('End of stream reached, no data to read');
        }
        $this->currentData = fgetcsv($this->fp, null, $this->delimiter, $this->enclosure);
        // Check if EOF is reached
        if (false === $this->currentData) {
            return false;
        } elseif (array(null) == $this->currentData) {
            /*
             * An empty line in the csv file
             * is returned as an array containing a NULL value.
             */
            if (! $this->ignoreEmptyLines) {
                throw new Error('Empty line found in file');
            }
            return $this->readLine();
        }
        $this->curLine++;

        if ($this->inputEncoding != $this->outputEncoding) {
            $inEnc = $this->inputEncoding;
            $outEnc = $this->outputEncoding;
            array_walk($this->currentData, function (&$str) use ($inEnc, $outEnc) {
                $str = mb_convert_encoding($str, $outEnc, $inEnc);
            });
        }

        return $this->currentData;
    }
148592
public function getAndClearBuffer($trim = "", $tolower = false)
		{
		$r = $this->getBuffer($trim, $tolower);
		$this->buffer = "";
		return $r;
		}
1207931
public static String[] getDataFromLine(final String line, final String seperator,
		final boolean trim)
	{
		final StringTokenizer tokenizer = new StringTokenizer(line, seperator);
		final List<String> data = new ArrayList<>();
		while (tokenizer.hasMoreElements())
		{
			final String string = tokenizer.nextToken();
			if (trim)
			{
				data.add(string.trim());
			}
			else
			{
				data.add(string);
			}

		}
		final String[] splittedLine = data.toArray(new String[0]);
		return splittedLine;
	}
1359690
public function getBuffer() {
        // cut last line (is always prompt)
        $buf = explode("\n", $this->buffer);
        unset($buf[count($buf) - 1]);
        $buf = implode("\n", $buf);
        return trim($buf);
    }
853812
public function read($count)
    {
        $contentLength = strlen($this->data);
        if ($this->position > $contentLength || $count > $contentLength - $this->position) {
            throw new EndOfStreamException(
                sprintf(
                    'End of stream reached when trying to read %d bytes. content length=%d, position=%d',
                    $count,
                    $contentLength,
                    $this->position
                )
            );
        }

        $chunk = substr($this->data, $this->position, $count);
        if ($chunk === false) {
            $chunk = '';
        }

        $readBytes = strlen($chunk);
        $this->position += $readBytes;

        return $chunk;
    }
1179542
protected function format($line)
    {
        if (is_array($line)) {
            return implode(' ', array_map('trim', $line));
        }

        $lines = preg_split('/\\r\\n|\\r|\\n/', $line);

        return trim(implode(' ', array_map('trim', $lines)));
    }
281511
protected function getLine()
    {
        $pos = false;
        foreach ($this->eol as $eol) {
            $pos = strpos($this->incomingData, $eol);
            if ($pos !== false) {
                break;
            }
        }
        if ($pos === false) {
            return false;
        }

        $len    = strlen($eol);
        $line   = \Erebot\Utils::toUTF8(substr($this->incomingData, 0, $pos));
        $this->incomingData    = substr($this->incomingData, $pos + $len);
        $this->rcvQueue[]      = $line;

        $logger = \Plop\Plop::getInstance();
        $logger->debug(
            '%(line)s',
            array('line' => addcslashes($line, "\000..\037"))
        );
        return true;
    }
557680
public function get($max_lines = 0)
    {
        //if $max_lines is set to 0, then get all the data

        $data = [];

        if ($max_lines > 0) {
            $line_count = 0;
        } else {
            $line_count = -1;
        } // so loop limit is ignored

        while ($line_count < $max_lines && false !== ($row = fgetcsv($this->fp, $this->length, $this->delimiter))) {
            if ($this->parse_header) {
                $row_new = null;
                foreach ($this->header as $i => $heading_i) {
                    $row_new[$heading_i] = $row[$i];
                }
                $data[] = $row_new;
            } else {
                $data[] = $row;
            }

            if ($max_lines > 0) {
                ++$line_count;
            }
        }

        if (1 === $max_lines && isset($data[0])) {
            return $data[0];
        }

        return $data;
    }
1319989
public function getHttpHost($trimPort = true)
    {
        if (!isset($_SERVER['HTTP_HOST'])) {
            return false;
        }
        if ($trimPort) {
            $host = explode(':', $_SERVER['HTTP_HOST']);
            return $host[0];
        }
        return $_SERVER['HTTP_HOST'];
    }
585742
public function getLine()
    {
        $data = fgetcsv($this->handle, 0, $this->delimiter, $this->enclosure, $this->escape_char);
        if ($data) {
            $this->line++;
        }

        return $data;
    }
1146335
public function equal($other, $trim = false)
    {
        $this->isString();

        if (false === $trim) {
            return parent::equal($other);
        }

        return $this->doCheck(function ($value) use ($other) {
            $this->throwExceptionIfFalse(
                trim($value) === trim($other),
                'Value %s is not equal to %s', $value, $other
            );
        });
    }
403972
protected function parseTransactionCode()
    {
        $results = [];
        if (preg_match('/^:61:.*?N(.{3}).*/', $this->getCurrentTransactionData(), $results)
            && !empty($results[1])
        ) {
            return trim($results[1]);
        }
        return '';
    }
205261
public function sendData( $data )
    {
        if ( is_resource( $this->connection ) )
        {
            if ( fwrite( $this->connection, $data . self::CRLF,
                        strlen( $data ) + strlen( self::CRLF  ) ) === false )
            {
                throw new ezcMailTransportException( 'Could not write to the stream. It was probably terminated by the host.' );
            }
        }
    }
183545
public function in($format = '')
    {
        if (empty($format)) {
            $line = fgets(STDIN);
        } else {
            $line = fscanf(STDIN, $format . PHP_EOL, $line);
        }

        return trim($line);
    }