Read and return the next line from the file.

@param int $mode (SKIP_EMPTY_LINES or RETURN_EVERY_LINE which is the default)
@return array|null the data from next line of the file or null if there are no more lines.
16821
public function getLine($mode = self::RETURN_EVERY_LINE)
    {
        $line = parent::getLine($mode);
        if ($line === null) { return null; }
        $parsed = str_getcsv($line, $this->delimiter, $this->enclosure, $this->escape);
        if ($mode === self::SKIP_EMPTY_LINES && self::isEmpty($parsed)) {
            return $this->getLine($mode);
        }
        return $parsed;
    }
1193995
public function read($length = null)
    {
        $buffer = '';
        $total = count($this->_streams) - 1;
        $remaining = (integer) ($length === null ? $this->_bufferSize : $length);
        $progressToNext = false;

        while ($remaining > 0) {

            // Progress to the next stream if needed.
            if ($progressToNext || $this->_streams[$this->_current]->eof()) {
                $progressToNext = false;
                if ($this->_current === $total) {
                    break;
                }
                $this->_current++;
            }

            $result = $this->_streams[$this->_current]->read($remaining);

            if (!$result) {
                $progressToNext = true;
                continue;
            }

            $buffer .= $result;
            $remaining = $length - strlen($buffer);
        }

        $this->_offset += strlen($buffer);
        return $buffer;
    }
886880
public function count($mode = null)
    {
        if ($this->data == null) {
            $ret = $this->client->get($this->url, $this->query);
            $this->data = $ret->getData();
        }
        return (int) ($this->data['_total_items'] ?? $this->data['total_items'] ?? 0);
    }
1177694
public static function read_line($f, $action = 'read')
    {
        static $last_line = '';
        static $use_last_line = false;
        if ('clear' == $action) {
            $last_line = '';

            return true;
        }
        if ('put-back' == $action) {
            $use_last_line = true;

            return true;
        }
        $line = $use_last_line ? $last_line : fgets($f);
        $line = ("\r\n" == substr($line, -2)) ?
            rtrim($line, "\r\n") . "\n" :
            $line;
        $last_line = $line;
        $use_last_line = false;

        return $line;
    }
716480
public function mode($mode = null)
    {
        if (func_num_args() === 0) {
            return $this->_mode;
        }
        $this->_mode = $mode;
        return $this;
    }
679744
protected function readLinesFromFile($filePath)
    {
        // Read file into an array of lines with auto-detected line endings
        $autodetect = ini_get('auto_detect_line_endings');
        ini_set('auto_detect_line_endings', '1');
        $lines = file($filePath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
        ini_set('auto_detect_line_endings', $autodetect);
        return $lines;
    }
169677
public static function getLines($file)
    {
        return !is_file($file) || !is_readable($file) || !($lines = @file($file, FILE_SKIP_EMPTY_LINES)) ? [] : $lines;
    }
117217
public function read_entry()
    {
        // read fresh lines, set them as current lines and create the entry
        $attrs = $this->next_lines(true);
        if (count($attrs) > 0) {
            $this->_lines_cur = $attrs;
        }
        return $this->current_entry();
    }
675018
private function read()
    {
        $s = null;

        for (; !feof($this->sock);) {
            if (($line = fgets($this->sock, 1e3)) == null) {
                continue;
            }

            $s = explode(' ', $line)[0];

            if (preg_match('#^[0-9]+$#', $s)) {
                break;
            }
        }

        return (int) $s;
    }
624528
protected function calculateMode($mode, $extended)
    {
        if (true === $extended) {
            return self::ALL;
        }

        if (self::READ === $mode) {
            return self::READONLY;
        }

        return self::WRITEONLY;
    }
45893
public function offsetGet($offset)
    {
        return isset($this->lines[$offset]) ? $this->lines[$offset] : null;
    }
945086
public function getMode($mode = 'list')
    {
        if ($this->getOrder()) {
            $website = $this->_storeManager
                ->getStore($this->getOrder()->getStoreId())
                ->getWebsite();
            $mode = $this->helper->getReviewDisplayType($website);
        }

        return $mode;
    }
786517
public function mrecv($mode = 0)
    {
        if ($this->verbose) {
            $this->getLogger()->debug('PRE RECV: '.$this->id);
        }
        $data = array();
        while (true) {
            $data[] = $this->recv($mode);
            if (!$this->getSockOpt(ZMQ::SOCKOPT_RCVMORE)) {
                break;
            }
        }

        $message = new Message($data);
        if ($this->verbose) {
            $this->getLogger()->debug('RECV: '.$this->id);
            $this->getLogger()->debug($message);
        }

        if (ZMQ::SOCKET_ROUTER === $this->getSocketType()) {
            $message->stripRoutingInformation();
        }

        return $message;
    }
402472
public function readline($length=null) {
		$this->assertReadable();
		return $this->format->readline($this->file, $length);
	}
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;
    }
702759
public function readLinesBetween(int $start, int $end) : array
    {
        $content = file($this->_path);
        $lines   = [];

        for($i = $start; $i < $end; $i++) {
            if(isset($content[$i])) {
                $lines[] = $content[$i];
            }
        }

        return $lines;
    }
479813
private static function convertMode($mode)
    {
        if (is_string($mode)) {
            $mode = defined('\Tideways\Profiler::MODE_' . strtoupper($mode))
                ? constant('\Tideways\Profiler::MODE_' . strtoupper($mode))
                : self::MODE_DISABLED;
        } else if (!is_int($mode)) {
            $mode = self::MODE_DISABLED;
        } else if (($mode & (self::MODE_FULL|self::MODE_BASIC)) === 0) {
            $mode = self::MODE_DISABLED;
        }

        return $mode;
    }