public function getLogs(int $limit = 0)
    {
        if (!file_exists($this->logFile)) {
            return [];
        }
        $lineCount = 0;
        $fileAsc = file($this->logFile);
        $file = array_reverse($fileAsc);
        $arrOutput = [];
        foreach ($file as $row) {
            $currentRow = $this->makeLogRow($row);
            if (!$currentRow) {
                continue;
            }
            $arrOutput[] = $currentRow;
            $lineCount++;
            if ($lineCount > $limit && $limit > 0) {
                break;
            }
        }
        return $arrOutput;
    }
public function getLogs(int $limit = 0)
    {
        if (!file_exists($this->logFile)) {
            return [];
        }
        $lineCount = 0;
        $fileAsc = file($this->logFile);
        $file = array_reverse($fileAsc);
        $arrOutput = [];
        foreach ($file as $row) {
            $currentRow = $this->makeLogRow($row);
            if (!$currentRow) {
                continue;
            }
            $arrOutput[] = $currentRow;
            $lineCount++;
            if ($lineCount > $limit && $limit > 0) {
                break;
            }
        }
        return $arrOutput;
    }
public function getLogs ( int $ limit = 0 ) { if ( ! file_exists ( $ this -> logFile ) ) { return [ ] ; } $ lineCount = 0 ; $ fileAsc = file ( $ this -> logFile ) ; $ file = array_reverse ( $ fileAsc ) ; $ arrOutput = [ ] ; foreach ( $ file as $ row ) { $ currentRow = $ this -> makeLogRow ( $ row ) ; if ( ! $ currentRow ) { continue ; } $ arrOutput [ ] = $ currentRow ; $ lineCount ++ ; if ( $ lineCount > $ limit && $ limit > 0 ) { break ; } } return $ arrOutput ; }
Reads a logfile line by line and makes it into an array
@param int $limit
@return array
Reads a logfile line by line and makes it into an array