original_string: 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);
      }
code: 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);
      }
code_tokens: 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 ) ; }
docstring: Returns logs from current file.
  
  @return array|null
docstring_tokens: Returns logs from current file .