Return the first lines of the input file

@param int $lineCount

@return string
353024
protected function firstLines($lineCount=20)
    {
        if ($this->firstLines !== null) {
            return $this->firstLines;
        }

        $this->firstLines = $this->convertEncoding($this->firstLinesRaw($lineCount));

        return $this->firstLines;

    }
1196882
protected function getFileCount($resultsCount, $maxLinesInFile, $fileCounter)
    {
        $leftToInsert = $resultsCount - ($fileCounter * $maxLinesInFile);
        if ($leftToInsert <= $maxLinesInFile) {
            $count = $leftToInsert;
        } else {
            $count = $maxLinesInFile;
        }

        return $count;
    }
354032
protected function getLineFormatted($line, $key, $last_frame_count)
    {
        // If this is the first thing we're writing, just return the line
        if ($last_frame_count == 0) {
            return $line;
        }

        $content = '';

        // If this is the first line of the frame,
        // move the cursor up the total number of previous lines from the previous frame
        if ($key == 0) {
            $content .= $this->util->cursor->up($last_frame_count);
        }

        $content .= $this->util->cursor->startOfCurrentLine();
        $content .= $this->util->cursor->deleteCurrentLine();
        $content .= $line;

        return $content;
    }
105225
public function readFileLine($length = null)
    {
        $this->openFile();
        //gets warning "fgets(): Length parameter must be greater than 0" when parameter is null and is passed to function
        if($length === null)
        {
            $line = fgets($this->getFile());
        }
        else
        {
            $line = fgets($this->getFile(), $length);
        }

        return $line;
    }
1298435
private function getFirstSegmentOfKey(Line $line)
    {
        // Remove first part since that part equals the page
        $key = substr($line->key, strpos($line->key, '.')+1);

        $length = strpos($key, '.')?: strlen($key);
        $key = substr($key, 0, $length);

        return $key;
    }
855170
public function extract($colorCount = 1)
    {
        if (!$this->isInitialized()) {
            $this->initialize();
        }

        return self::mergeColors($this->sortedColors, $colorCount, 100 / $colorCount);
    }
492213
public function getLineNumber(){
		if( $this->index ){
			// https://bugs.php.net/bug.php?id=49790
			if (ini_get("mbstring.func_overload")) {
				return substr_count(substr($this->input, 0, $this->index), "\n") + 1;
			} else {
				return substr_count($this->input, "\n", 0, $this->index) + 1;
			}
		}
		return 1;
	}
1313147
public function getRowCount()
	{
		$iterator	= new FS_File_CSV_Iterator( $this->fileName, $this->delimiter );
		$counter	= 0;
		while( $iterator->next() )
			$counter++;
		if( $counter && $this->withHeaders )
			$counter--;
		return $counter;
	}
82238
public function getInitialBlock()
    {
        $linePad = $this->csvFormat->hasHeaderRow() ?
            $this->csvFormat->getHeaderRow() - 1 :
            $this->csvFormat->getDataStart() - 1;

        return $this->initial . str_repeat($this->getRowSeparator(), $linePad);
    }
121338
def _number_of_line(member_tuple):
    """"""
    member = member_tuple[1]
    try:
        return member.__code__.co_firstlineno
    except AttributeError:
        pass
    try:
        return inspect.findsource(member)[1]
    except BaseException:
        pass
    for value in vars(member).values():
        try:
            return value.__code__.co_firstlineno
        except AttributeError:
            pass
    return 0
250208
protected String getNextLine(int newlineCount) throws IOException {
        if (newlineCount == 0) {
            return "";
        }
        StringBuffer str = new StringBuffer();
        int b;
        while (pis.available() > 0) {
            b = pis.read();
            if (b == -1) {
                return "";
            }
            if (b == '\n') {
                newlineCount--;
                if (newlineCount == 0) {
                    log.debug("Read lines: " + str.toString());
                    String[] lines = str.toString().split("\n");
                    // FIXME: this leads to queuing lines so we will have time lag!
                    return lines[lines.length - 1];
                }
            }
            str.append((char) b);
        }
        return "";
    }
1360944
private function popLine() {
		$newLinePos = strpos($this->analysisResponse, "\n", $this->analysisOffset);
		
		if ($newLinePos === false) {
			throw new \Exception("End of file reached!");
		}
		
		$line = substr($this->analysisResponse, $this->analysisOffset, ($newLinePos - $this->analysisOffset));
        $this->analysisOffset = $newLinePos + 1;
		return $line;
	}
1203691
private function checkDifferentAnnotations(Annotation $annotation, $linesCount)
    {
        if ($linesCount === 1) {
            return;
        }

        $this->phpcsFile->addError(
            \sprintf('Expected 1 lines between different annotations types, found %d.', $linesCount),
            $annotation->getStartPointer(),
            'LineBetweenDifferentTags'
        );
    }
1164329
private function getLinesNumbers(string $line)
    {
        $matches = [];
        preg_match('/@@ -(.*) \+(.*) @@?(.*)/', $line, $matches);
        if (!strpos($matches[1], ',')) {
            // one line
            $this->originStartLine = $matches[1];
            $this->originEndLine = $matches[1];
        } else {
            list($this->originStartLine, $this->originEndLine) = explode(',', $matches[1]);
        }

        if (!strpos($matches[2], ',')) {
            // one line
            $this->destStartLine = $matches[2];
            $this->destEndLine = $matches[2];
        } else {
            list($this->destStartLine, $this->destEndLine) = explode(',', $matches[2]);
        }
    }
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;
    }
932575
public function lines()
    {
        $array = $this->split('[\r\n]{1,2}', $this->str);
        for ($i = 0; $i < count($array); $i++) {
            $array[$i] = static::create($array[$i], $this->encoding);
        }

        return $array;
    }
876016
protected function sortSeparatorsByHighestCount($line, $delimiter)
    {
        $separatorsByCount = [];

        foreach ($this->separators as $separator) {
            $data = str_getcsv($line, $separator, $delimiter);
            $count = count($data);

            if (!isset($separatorsByCount[$count])) {
                $separatorsByCount[$count] = [];
            }

            $separatorsByCount[$count][] = $separator;
        }

        $sorted = [];
        $counts = array_keys($separatorsByCount);

        rsort($counts, SORT_NUMERIC);

        foreach ($counts as $count) {
            $sorted[$count] = $separatorsByCount[$count];
        }

        return $sorted;
    }