get a line from the file.

@return array
960041
protected function GetLine()
    {
        $sLine = fgets($this->fp, 2048 * 16);
        if (false === $sLine) {
            return $sLine;
        }
        // find out if the line contains an uneven number of '"'. if so, we assume, that the line contains a line break
        $sLine = trim($sLine);
        $aTmpParts = explode('"', $sLine);
        if (1 != (count($aTmpParts) % 2)) {
            // need to read until we find the first '"'...
            $bDone = false;
            do {
                $sTmpLine = fgets($this->fp, 2048 * 16);
                if (false === $sTmpLine) {
                    $bDone = true;
                } else {
                    $sTmpLine = trim($sTmpLine);
                    $sLine .= "\n".$sTmpLine;
                    $aTmpParts = explode('"', $sTmpLine);
                    if (1 != (count($aTmpParts) % 2)) {
                        $bDone = true;
                    }
                }
            } while (!$bDone);
        }
        $sLine = utf8_encode($sLine);
        $aParts = explode($this->sLineSplit, $sLine);

        // strip quotes
        foreach (array_keys($aParts) as $sIndex) {
            $aParts[$sIndex] = trim($aParts[$sIndex]);
            if ('"' == substr($aParts[$sIndex], 0, 1) && '"' == substr($aParts[$sIndex], -1)) {
                $aParts[$sIndex] = substr($aParts[$sIndex], 1, -1);
            }
        }
        reset($aParts);

        return $aParts;
    }
1330704
public function getLogsFromCurrentFile()
    {
        if ($this->currentFile === null) {
            return [];
        }

        if (File::size($this->currentFile) > $this->maxFileSize) {
            return;
        }

        $datePattern = '\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}';
        $pattern = "/\\[$datePattern\\].*/";
        $fileContent = File::get($this->currentFile);

        preg_match_all($pattern, $fileContent, $rows);

        if (!is_array($rows) || count($rows) === 0) {
            return [];
        }

        $rows = $rows[0];
        $logs = [];

        foreach ($rows as $row) {
            preg_match(
                "/^\\[($datePattern)\\].*?(\\w+)\\."
                . '([A-Z]+): (.*?)( in .*?:[0-9]+)?$/',
                $row,
                $matches
            );

            if (!isset($matches[4])) {
                continue;
            }

            $level = Str::lower($matches[3]);

            $inFile = null;
            if (isset($matches[5])) {
                $inFile = substr($matches[5], 4);
            }

            $logs[] = (object) [
                'context' => $matches[2],
                'level' => $level,
                'levelClass' => static::$levelsClasses[$level],
                'levelImg' => static::$levelsImgs[$level],
                'date' => $matches[1],
                'text' => trim($matches[4]),
                'inFile' => $inFile,
            ];
        }

        return array_reverse($logs);
    }
708558
private function peekLine()
    {
        if ($this->filePeek == null) {
            $this->filePeek = fgets($this->fileHandle);
        }

        return $this->filePeek;
    }
188101
public function getArray()
    {
        $parsed = @parse_ini_file($this->context, true);

        if (! $parsed) {
            throw new InvalidFileException('Unable to parse invalid INI file at ' . $this->context);
        }

        return $parsed;
    }
767348
public function get()
    {
        return [
            'type' => 'typeof',
            'left' => $this->leftOperand->get(),
            'file' => $this->file,
            'line' => $this->line,
            'char' => $this->char,
        ];
    }
1231888
public function getArray()
    {
        try {
            $parsed = TomlParser::ParseFile($this->context);
        } catch (ParseException $e) {
            throw new InvalidFileException($e->getMessage());
        }

        // if (! is_array($parsed)) {
        //     throw new InvalidFileException('Unable to parse invalid TOML file at ' . $this->context);
        // }

        return $parsed;
    }
125913
protected function getContext()
    {
        $trace = debug_backtrace();

        $file = isset($trace[2]['file'])
            ? $trace[2]['file']
            : ''
        ;

        $line = isset($trace[2]['line'])
            ? $trace[2]['line']
            : ''
        ;

        return [
            'file' => $file,
            'line' => $line,
        ];
    }
930288
protected function fetch()
    {
        return Collection::make(file($this->source, FILE_SKIP_EMPTY_LINES | FILE_IGNORE_NEW_LINES))
            ->map(function ($line) {
                // capture everything between single quotes
                preg_match_all(self::PATTERN_CAPTURE, $line, $matches);
                // matches[x]
                //   0 - complete match
                //   1 - captures
                return $matches[ 1 ];
            })->filter();
    }
986327
protected function readLine()
    {
        $buffer = '';

        while ($buffer === '') {
            if (($buffer = fgets($this->getFileHandler())) === false) {
                $this->currentLine = null;

                return;
            }
            $buffer = trim($buffer, "\n\r\0");

            if (!$this->skipEmptyLines) {
                break;
            }
        }

        $this->currentLine = $buffer;
    }
1288525
public function getFiles() : array
    {
        if(!$this->_isLoaded) {
            $this->load();
        }

        return array_map(function($file) {
            return new File($this->getPath(). DIRECTORY_SEPARATOR .$file);
        }, $this->_files);
    }
537789
public function getInfo()
    {
        $error = $this->getMessage().PHP_EOL;
        $error .= 'File: '.$this->getFile().PHP_EOL;
        $error .= 'Line: '.$this->getLine().PHP_EOL;

        return $error;
    }
1116913
public function getContent()
	{
		$file = $this->getFileLocation();

		$content = file_get_contents($file);

		return explode(
			$this->getConfig('line_separator'),
			$content
		);
	}
714844
public function getHeaderContent()
    {
        if (!$this->headerFileHandle) {
            return null;
        }

        fseek($this->headerFileHandle, 0);

        $lines = array();
        while ($line = trim(fgets($this->headerFileHandle), "\n\r")) {
            $lines[] = $line;
        }

        return $lines;
    }
717773
protected function getFiles() : array
    {
        $fileOrDirectory = base_path($this->argument('path'));
        if (! $this->files->exists($fileOrDirectory)) {
            $this->error($this->argument('path').' is not a file or a directory.');
            exit();
        }
        if ($this->files->isFile($fileOrDirectory)) {
            $files = [$fileOrDirectory];
        } elseif ($this->files->isDirectory($fileOrDirectory)) {
            $files = $this->files->files($fileOrDirectory);
        }

        return $files;
    }
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;
    }
779085
public function parse() : array
    {
        $fileLines = $this->getFileLines();

        $data = [];

        $currentSection  = '';
        $currentDivision = '';

        for ($line = 0, $count = count($fileLines); $line < $count; ++$line) {
            $currentLine       = ($fileLines[$line]);
            $currentLineLength = mb_strlen($currentLine);

            if (0 === $currentLineLength) {
                continue;
            }

            if (';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;' === mb_substr($currentLine, 0, 40)) {
                $currentDivision = trim(mb_substr($currentLine, 41));

                continue;
            }

            // We only skip comments that *start* with semicolon
            if (';' === $currentLine[0]) {
                continue;
            }

            if ('[' === $currentLine[0]) {
                $currentSection = mb_substr($currentLine, 1, ($currentLineLength - 2));

                continue;
            }

            $bits = explode('=', $currentLine);

            if (2 < count($bits)) {
                throw new \RuntimeException("Too many equals in line: {$currentLine}, in Division: {$currentDivision}");
            }

            if (2 > count($bits)) {
                $bits[1] = '';
            }

            $data[$currentSection][$bits[0]]   = $bits[1];
            $data[$currentSection]['Division'] = $currentDivision;
        }

        if ($this->shouldSort()) {
            $data = $this->sortArrayAndChildArrays($data);
        }

        $this->data = $data;

        return $data;
    }
315219
public function getSummary()
    {
        ob_start();

        printf(
            "%s in file '%s' line %s",
            $this->class,
            $this->getFile(),
            $this->getLine()
        );

        if ($this->wasHandled()) {
            echo ' Exception was handled';
        }

        return ob_get_clean();
    }