FileProfilerStorage
in package
implements
ProfilerStorageInterface
Storage for profiler using files.
Tags
Interfaces, Classes and Traits
- ProfilerStorageInterface
- ProfilerStorageInterface.
Table of Contents
- $folder : string
- Folder where profiler data are stored.
- __construct() : mixed
- Constructs the file storage using a "dsn-like" path.
- find() : array<string|int, mixed>
- Finds profiler tokens for the given criteria.
- purge() : mixed
- Purges all data from the database.
- read() : Profile|null
- Reads data associated with the given token.
- write() : bool
- Saves a Profile.
- createProfileFromData() : mixed
- getFilename() : string
- Gets filename to store data, associated to the token.
- getIndexFilename() : string
- Gets the index filename.
- readLineFromFile() : mixed
- Reads a line in the file, backward.
Properties
$folder
Folder where profiler data are stored.
private
string
$folder
Methods
__construct()
Constructs the file storage using a "dsn-like" path.
public
__construct(string $dsn) : mixed
Example : "file:/path/to/the/storage/folder"
Parameters
- $dsn : string
-
The DSN
Tags
Return values
mixed —find()
Finds profiler tokens for the given criteria.
public
find(mixed $ip, mixed $url, mixed $limit, mixed $method[, mixed $start = null ][, mixed $end = null ][, mixed $statusCode = null ]) : array<string|int, mixed>
Parameters
- $ip : mixed
-
The IP
- $url : mixed
-
The URL
- $limit : mixed
-
The maximum number of tokens to return
- $method : mixed
-
The request method
- $start : mixed = null
-
The start date to search from
- $end : mixed = null
-
The end date to search to
- $statusCode : mixed = null
Return values
array<string|int, mixed> —An array of tokens
purge()
Purges all data from the database.
public
purge() : mixed
Return values
mixed —read()
Reads data associated with the given token.
public
read(mixed $token) : Profile|null
Parameters
- $token : mixed
-
A token
Return values
Profile|null —The profile associated with token
write()
Saves a Profile.
public
write(Profile $profile) : bool
Parameters
- $profile : Profile
Tags
Return values
bool —Write operation successful
createProfileFromData()
protected
createProfileFromData(mixed $token, mixed $data[, mixed $parent = null ]) : mixed
Parameters
- $token : mixed
- $data : mixed
- $parent : mixed = null
Return values
mixed —getFilename()
Gets filename to store data, associated to the token.
protected
getFilename(string $token) : string
Parameters
- $token : string
Return values
string —The profile filename
getIndexFilename()
Gets the index filename.
protected
getIndexFilename() : string
Return values
string —The index filename
readLineFromFile()
Reads a line in the file, backward.
protected
readLineFromFile(resource $file) : mixed
This function automatically skips the empty lines and do not include the line return in result value.
Parameters
- $file : resource
-
The file resource, with the pointer placed at the end of the line to read
Return values
mixed —A string representing the line or null if beginning of file is reached