Profiler
in package
implements
ResetInterface
Profiler.
Tags
Interfaces, Classes, Traits and Enums
- ResetInterface
- Provides a way to reset an object to its initial state.
Table of Contents
- $collectors : array<string|int, DataCollectorInterface>
- $enabled : mixed
- $initiallyEnabled : mixed
- $logger : mixed
- $storage : mixed
- __construct() : mixed
- add() : mixed
- Adds a Collector.
- all() : array<string|int, mixed>
- Gets the Collectors associated with this profiler.
- collect() : Profile|null
- Collects data for the given Response.
- disable() : mixed
- Disables the profiler.
- enable() : mixed
- Enables the profiler.
- find() : array<string|int, mixed>
- Finds profiler tokens for the given criteria.
- get() : DataCollectorInterface
- Gets a Collector by name.
- has() : bool
- Returns true if a Collector for the given name exists.
- loadProfile() : Profile|null
- Loads the Profile for the given token.
- loadProfileFromResponse() : Profile|null
- Loads the Profile for the given Response.
- purge() : mixed
- Purges all data from the storage.
- reset() : mixed
- saveProfile() : bool
- Saves a Profile.
- set() : mixed
- Sets the Collectors associated with this profiler.
- getTimestamp() : int|null
Properties
$collectors
private
array<string|int, DataCollectorInterface>
$collectors
= []
$enabled
private
mixed
$enabled
= true
$initiallyEnabled
private
mixed
$initiallyEnabled
= true
$logger
private
mixed
$logger
$storage
private
mixed
$storage
Methods
__construct()
public
__construct(ProfilerStorageInterface $storage[, LoggerInterface $logger = null ][, bool $enable = true ]) : mixed
Parameters
- $storage : ProfilerStorageInterface
- $logger : LoggerInterface = null
- $enable : bool = true
Return values
mixed —add()
Adds a Collector.
public
add(DataCollectorInterface $collector) : mixed
Parameters
- $collector : DataCollectorInterface
Return values
mixed —all()
Gets the Collectors associated with this profiler.
public
all() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of collectors
collect()
Collects data for the given Response.
public
collect(Request $request, Response $response) : Profile|null
Parameters
Return values
Profile|null —A Profile instance or null if the profiler is disabled
disable()
Disables the profiler.
public
disable() : mixed
Return values
mixed —enable()
Enables the profiler.
public
enable() : mixed
Return values
mixed —find()
Finds profiler tokens for the given criteria.
public
find(string $ip, string $url, string $limit, string $method, string $start, string $end[, string $statusCode = null ]) : array<string|int, mixed>
Parameters
- $ip : string
-
The IP
- $url : string
-
The URL
- $limit : string
-
The maximum number of tokens to return
- $method : string
-
The request method
- $start : string
-
The start date to search from
- $end : string
-
The end date to search to
- $statusCode : string = null
-
The request status code
Tags
Return values
array<string|int, mixed> —An array of tokens
get()
Gets a Collector by name.
public
get(string $name) : DataCollectorInterface
Parameters
- $name : string
-
A collector name
Tags
Return values
DataCollectorInterface —A DataCollectorInterface instance
has()
Returns true if a Collector for the given name exists.
public
has(string $name) : bool
Parameters
- $name : string
-
A collector name
Return values
bool —loadProfile()
Loads the Profile for the given token.
public
loadProfile(string $token) : Profile|null
Parameters
- $token : string
-
A token
Return values
Profile|null —A Profile instance
loadProfileFromResponse()
Loads the Profile for the given Response.
public
loadProfileFromResponse(Response $response) : Profile|null
Parameters
- $response : Response
Return values
Profile|null —A Profile instance
purge()
Purges all data from the storage.
public
purge() : mixed
Return values
mixed —reset()
public
reset() : mixed
Return values
mixed —saveProfile()
Saves a Profile.
public
saveProfile(Profile $profile) : bool
Parameters
- $profile : Profile
Return values
bool —set()
Sets the Collectors associated with this profiler.
public
set([array<string|int, DataCollectorInterface> $collectors = [] ]) : mixed
Parameters
- $collectors : array<string|int, DataCollectorInterface> = []
-
An array of collectors
Return values
mixed —getTimestamp()
private
getTimestamp(string|null $value) : int|null
Parameters
- $value : string|null