@param int $numberOfLines

@return array
173888
public function getLastLines(int $numberOfLines = self::DEFAULT_NUMBER_OF_LINES): array
    {
        $lines = [];
        if (null === $this->file) {
            return $lines;
        }

        $this->file->seek($this->lineCount);
        $currentKey = $this->file->key();
        while ($currentKey >= 0) {
            $line = $this->getDefaultParser()->parse($this->file->current());
            if ($line) {
                $lines[] = $line;
            }

            if (--$currentKey >= 0) {
                $this->file->seek($currentKey);
            }

            if (\count($lines) >= $numberOfLines) {
                break;
            }
        }

        return $lines;
    }
1101433
public function readLines()
    {
        if ($this->getFileObject()->isFile()) {
            if ($this->skipEmptyLines) {
                // skip empty lines
                $lines = file($this->getFileObject()->getPathname(), FILE_SKIP_EMPTY_LINES | FILE_IGNORE_NEW_LINES);
            } else {
                $lines = file($this->getFileObject()->getPathname(), FILE_IGNORE_NEW_LINES);
            }

            if (is_array($lines)) {
                return $lines;
            }
        }
        return array();
    }
239375
public function getLines() : int
    {
        return $this->classes
            ->map(function ($class) {
                return $class->getFileName();
            })
            ->pipe(function ($classes) {
                return app(Analyser::class)->countFiles($classes->all(), false)['loc'];
            });
    }
52404
public function getLinePositions($diff)
    {
        if (empty($diff)) {
            return null;
        }

        $rtn = array();

        $diffLines = explode(PHP_EOL, $diff);

        while (count($diffLines)) {
            $line = array_shift($diffLines);

            if (substr($line, 0, 2) == '@@') {
                array_unshift($diffLines, $line);
                break;
            }
        }

        $lineNumber = 0;
        $position = 0;

        foreach ($diffLines as $diffLine) {
            if (preg_match('/@@\s+\-[0-9]+\,[0-9]+\s+\+([0-9]+)\,([0-9]+)/', $diffLine, $matches)) {
                $lineNumber = (int)$matches[1] - 1;
            }

            $rtn[$lineNumber] = $position;

            $lineNumber++;
            $position++;
        }

        return $rtn;
    }
396648
def num_lines(self):
        
        if self.from_stdin:
            return None
        if not self._num_lines:
            self._iterate_lines()
        return self._num_lines
896153
public static function countLinesFromSource( $content )
	{
		$counter		= 0;
		$numberCodes	= 0;
		$numberDocs		= 0;
		$numberStrips	= 0;
		$linesCodes		= array();
		$linesDocs		= array();
		$linesStrips	= array();

		$lines		= explode( "\n", $content );
		foreach( $lines as $line )
		{
			if( preg_match( "@^(\t| )*/?\*@", $line ) )
			{
				$linesDocs[$counter] = $line;
				$numberDocs++;
			}
			else if( preg_match( "@^(<\?php|<\?|\?>|\}|\{|\t| )*$@", trim( $line ) ) )
			{
				$linesStrips[$counter] = $line;
				$numberStrips++;
			}
			else if( preg_match( "@^(public|protected|private|class|function|final|define|import)@", trim( $line ) ) )
			{
				$linesStrips[$counter] = $line;
				$numberStrips++;
			}
			else
			{
				$linesCodes[$counter] = $line;
				$numberCodes++;
			}
			$counter ++;
		}
		$data	= array(
			'length'		=> strlen( $content ),
			'numberCodes'	=> $numberCodes,
			'numberDocs'	=> $numberDocs,
			'numberStrips'	=> $numberStrips,
			'linesTotal'	=> $counter,
			'linesCodes'	=> $linesCodes,
			'linesDocs'		=> $linesDocs,
			'linesStrips'	=> $linesStrips,
			'ratioCodes'	=> $numberCodes / $counter * 100,
			'ratioDocs'		=> $numberDocs / $counter * 100,
			'ratioStrips'	=> $numberStrips / $counter * 100,
		);
		return $data;
	}
822779
protected function decodeSize($lines)
    {
        $sizes = [];
        foreach (array_map([$this, 'decodeLine'], $lines) as $tokens) {
            if (!isset($tokens[1]) || $tokens[1] !== 'FETCH') {
                continue;
            }
            if (!isset($tokens[2][0]) || $tokens[2][0] !== 'UID') {
                continue;
            }
            if (!isset($tokens[2][2]) || $tokens[2][2] !== 'RFC822.SIZE') {
                continue;
            }
            if (!isset($tokens[2][1]) || !isset($tokens[2][3])) {
                continue;
            }
            $sizes[$tokens[2][1]] = $tokens[2][3];
        }
        return $sizes;
    }
841610
def get_relativelinenumbertable(self):
        

        lnt = self.get_linenumbertable()
        if lnt:
            lineoff = lnt[0][1]
            return tuple((o, l - lineoff) for (o, l) in lnt)
        else:
            return tuple()
454256
public function parseRemoteBranches(array $lines)
    {
        $branches = [];
        $delimiter = ' ';
        foreach ($lines as $line) {
            $line = trim($line);
            $line = preg_replace('/\s+/', ' ', $line);
            $parts = explode($delimiter, $line);
            if (count($parts) > 1) {
                $branches[$parts[0]] = ['local_relationship' => $parts[1]];
            }
        }

        return $branches;
    }
1357209
public function getLineCount() {
    $count = 1;

    $this
      ->find(Filter::isInstanceOf('\Pharborist\WhitespaceNode'))
      ->each(function(WhitespaceNode $node) use (&$count) {
        $count += $node->getNewlineCount();
      });

    return $count;
  }
1257188
private function parseLines(array $lines)
    {
        $originUnchanged = $this->originStartLine;
        $destUnchanged = $this->destStartLine;

        $deleted = $this->originStartLine;
        $new = $this->destStartLine;
        foreach ($lines as $line) {
            if (preg_match('/^\+(.*)/', $line)) {
                $this->lines[] = new DiffChunkLineAdded($new++, preg_replace('/\+(.*)/', ' $1', $line));
                $destUnchanged++;
            } else if (preg_match('/^-(.*)/', $line)) {
                $this->lines[] = new DiffChunkLineDeleted($deleted++, preg_replace('/-(.*)/', ' $1', $line));
                $originUnchanged++;
            } else if (preg_match('/^ (.*)/', $line) || $line == '') {
                $this->lines[] = new DiffChunkLineUnchanged($originUnchanged++, $destUnchanged++, $line);
                $deleted++;
                $new++;
            } else if (!preg_match('/\\ No newline at end of file/', $line)) {
                throw new \Exception(sprintf('GitElephant was unable to parse the line %s', $line));
            }
        }
    }
387980
public function getMaxLineLength($lines)
    {
        if (!is_array($lines)) {
            $lines = explode("\n", $lines);
        }
        $lineLength = 0;
        // find the longest line
        foreach ($lines as $line) {
            $currentLineLength = strlen($line);
            if ($currentLineLength > $lineLength) {
                $lineLength = $currentLineLength;
            }
        }
        return $lineLength;
    }
922549
public function getRulers($line = 10)
    {
        if ($line == 0) {
            return [];
        }
        $data = [0];
        $percent = ($this->panel->duration / 100);
        $row = $this->panel->duration / $line;
        $precision = $row > 100 ? -2 : -1;
        for ($i = 1; $i < $line; $i++) {
            $ms = round($i * $row, $precision);
            $data[$ms] = $ms / $percent;
        }
        return $data;
    }
265253
protected function parseLineNumber($lines) {
    $number = 0;

    foreach ($lines as $k => $line) {
      if (strpos($line, '----') === 0) {
        $string = trim($lines[$k - 1]);
        $string = explode('|', $string);
        $number = trim($string[0]);
        break;
      }
    }

    return (int) $number;
  }
1150857
private function parseOutputLines(array $lines)
    {
        foreach ($lines as $line) {
            preg_match('/([MADRCU\? ])?([MADRCU\? ])?\ "?(\S+)"? ?( -> )?(\S+)?/', $line, $matches);
            $x = isset($matches[1]) ? $matches[1] : null;
            $y = isset($matches[2]) ? $matches[2] : null;
            $file = isset($matches[3]) ? $matches[3] : null;
            $renamedFile = isset($matches[4]) ? $matches[4] : null;
            $this->files[] = StatusFile::create($x, $y, $file, $renamedFile);
        }
    }
386288
protected function nextLine()
    {
        if ($this->lineNumber < count($this->lines)) {
            return $this->lines[$this->lineNumber++];
        }
        return false;
    }
353024
protected function firstLines($lineCount=20)
    {
        if ($this->firstLines !== null) {
            return $this->firstLines;
        }

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

        return $this->firstLines;

    }