seek($start_line); while (!$file->eof()) { $line = trim($file->current()); if ($line) { $log[] = json_decode($line, true); // JSON decode each line } $file->next(); } } catch (\Exception $e) { // Handle exception if file operations fail Helper::log("Failed to read log file: " . $e->getMessage(), 'fsi_log_handler', 'error'); } } else { // Fallback if SplFileObject doesn't exist $current_line = 1; $handle = fopen($file_path, "r"); if ($handle) { while (($line = fgets($handle)) !== false) { if ($current_line >= $start_line) { $line = trim($line); if ($line) { $log[] = json_decode($line, true); // JSON decode each line } } $current_line++; } fclose($handle); } else { // Handle error if file can't be opened Helper::log("Failed to open log file: $file_path", 'fsi_log_handler', 'error'); } } return $log; } }