class FileProfilerStorage implements ProfilerStorageInterface

Storage for profiler using files.

Methods

__construct(string $dsn)

Constructs the file storage using a "dsn-like" path.

array
find(string $ip, string $url, string $limit, string $method, int|null $start = null, int|null $end = null)

Finds profiler tokens for the given criteria.

purge()

Purges all data from the database.

read(string $token)

Reads data associated with the given token.

bool
write(Profile $profile)

Saves a Profile.

string
getFilename(string $token)

Gets filename to store data, associated to the token.

string
getIndexFilename()

Gets the index filename.

mixed
readLineFromFile(resource $file)

Reads a line in the file, backward.

createProfileFromData($token, $data, $parent = null)

No description

Details

at line 37
__construct(string $dsn)

Constructs the file storage using a "dsn-like" path.

Example : "file:/path/to/the/storage/folder"

Parameters

string $dsn The DSN

Exceptions

RuntimeException

at line 52
array find(string $ip, string $url, string $limit, string $method, int|null $start = null, int|null $end = null)

Finds profiler tokens for the given criteria.

Parameters

string $ip The IP
string $url The URL
string $limit The maximum number of tokens to return
string $method The request method
int|null $start The start date to search from
int|null $end The end date to search to

Return Value

array An array of tokens

at line 102
purge()

Purges all data from the database.

at line 120
Profile read(string $token)

Reads data associated with the given token.

The method returns false if the token does not exist in the storage.

Parameters

string $token A token

Return Value

Profile The profile associated with token

at line 134
bool write(Profile $profile)

Saves a Profile.

Parameters

Profile $profile

Return Value

bool Write operation successful

at line 199
protected string getFilename(string $token)

Gets filename to store data, associated to the token.

Parameters

string $token

Return Value

string The profile filename

at line 213
protected string getIndexFilename()

Gets the index filename.

Return Value

string The index filename

at line 227
protected mixed readLineFromFile(resource $file)

Reads a line in the file, backward.

This function automatically skips the empty lines and do not include the line return in result value.

Parameters

resource $file The file resource, with the pointer placed at the end of the line to read

Return Value

mixed A string representing the line or null if beginning of file is reached

at line 265
protected createProfileFromData($token, $data, $parent = null)

Parameters

$token
$data
$parent