throw new \
RuntimeException(sprintf('Please check your configuration. You are trying to use FileStorage with an invalid dsn "%s". The expected format is "file:/path/to/the/storage/folder".',
$dsn));
} $this->folder =
substr($dsn, 5
);
if (!
is_dir($this->folder
) && false === @
mkdir($this->folder, 0777, true
) && !
is_dir($this->folder
)) { throw new \
RuntimeException(sprintf('Unable to create the storage directory (%s).',
$this->folder
));
} } public function find(?string
$ip, ?string
$url, ?int
$limit, ?string
$method, int
$start = null, int
$end = null, string
$statusCode = null
): array
{ $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);