CodeExplorer readLineFromFile example
$file =
$this->
getIndexFilename();
if (!
file_exists($file)) { return [];
} $file =
fopen($file, 'r'
);
fseek($file, 0, \SEEK_END
);
$result =
[];
while (\
count($result) <
$limit &&
$line =
$this->
readLineFromFile($file)) { $values =
str_getcsv($line);
if (7 !== \
count($values)) { // skip invalid lines
continue;
} [$csvToken,
$csvIp,
$csvMethod,
$csvUrl,
$csvTime,
$csvParent,
$csvStatusCode] =
$values;
$csvTime =
(int) $csvTime;
if ($ip && !
str_contains($csvIp,
$ip) ||
$url && !
str_contains($csvUrl,
$url) ||
$method && !
str_contains($csvMethod,
$method) ||
$statusCode && !
str_contains($csvStatusCode,
$statusCode)) { $file =
$this->
getIndexFilename();
if (!
file_exists($file)) { return [];
} $file =
fopen($file, 'r'
);
fseek($file, 0, \SEEK_END
);
$result =
[];
while (\
count($result) <
$limit &&
$line =
$this->
readLineFromFile($file)) { $values =
str_getcsv($line);
if (7 !== \
count($values)) { // skip invalid lines
continue;
} [$csvToken,
$csvIp,
$csvMethod,
$csvUrl,
$csvTime,
$csvParent,
$csvStatusCode] =
$values;
$csvTime =
(int) $csvTime;
if ($ip && !
str_contains($csvIp,
$ip) ||
$url && !
str_contains($csvUrl,
$url) ||
$method && !
str_contains($csvMethod,
$method) ||
$statusCode && !
str_contains($csvStatusCode,
$statusCode)) {