🔧
This commit is contained in:
@@ -45,7 +45,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
/**
|
||||
* @param \Closure|null $filter A filter to apply on the list of tokens
|
||||
*/
|
||||
public function find(?string $ip, ?string $url, ?int $limit, ?string $method, int $start = null, int $end = null, string $statusCode = null/* , \Closure $filter = null */): array
|
||||
public function find(?string $ip, ?string $url, ?int $limit, ?string $method, ?int $start = null, ?int $end = null, ?string $statusCode = null/* , \Closure $filter = null */): array
|
||||
{
|
||||
$filter = 7 < \func_num_args() ? func_get_arg(7) : null;
|
||||
$file = $this->getIndexFilename();
|
||||
@@ -59,7 +59,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
|
||||
$result = [];
|
||||
while (\count($result) < $limit && $line = $this->readLineFromFile($file)) {
|
||||
$values = str_getcsv($line);
|
||||
$values = str_getcsv($line, ',', '"', '\\');
|
||||
|
||||
if (7 > \count($values)) {
|
||||
// skip invalid lines
|
||||
@@ -193,7 +193,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
$profile->getParentToken(),
|
||||
$profile->getStatusCode(),
|
||||
$profile->getVirtualType() ?? 'request',
|
||||
]);
|
||||
], ',', '"', '\\');
|
||||
fclose($file);
|
||||
|
||||
if (1 === mt_rand(1, 10)) {
|
||||
@@ -272,7 +272,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
/**
|
||||
* @return Profile
|
||||
*/
|
||||
protected function createProfileFromData(string $token, array $data, Profile $parent = null)
|
||||
protected function createProfileFromData(string $token, array $data, ?Profile $parent = null)
|
||||
{
|
||||
$profile = new Profile($token);
|
||||
$profile->setIp($data['ip']);
|
||||
@@ -300,7 +300,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
return $profile;
|
||||
}
|
||||
|
||||
private function doRead($token, Profile $profile = null): ?Profile
|
||||
private function doRead($token, ?Profile $profile = null): ?Profile
|
||||
{
|
||||
if (!$token || !file_exists($file = $this->getFilename($token))) {
|
||||
return null;
|
||||
@@ -334,7 +334,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
}
|
||||
|
||||
while ($line = fgets($handle)) {
|
||||
$values = str_getcsv($line);
|
||||
$values = str_getcsv($line, ',', '"', '\\');
|
||||
|
||||
if (7 > \count($values)) {
|
||||
// skip invalid lines
|
||||
|
||||
@@ -37,7 +37,7 @@ class Profiler implements ResetInterface
|
||||
private bool $initiallyEnabled = true;
|
||||
private bool $enabled = true;
|
||||
|
||||
public function __construct(ProfilerStorageInterface $storage, LoggerInterface $logger = null, bool $enable = true)
|
||||
public function __construct(ProfilerStorageInterface $storage, ?LoggerInterface $logger = null, bool $enable = true)
|
||||
{
|
||||
$this->storage = $storage;
|
||||
$this->logger = $logger;
|
||||
@@ -128,7 +128,7 @@ class Profiler implements ResetInterface
|
||||
*
|
||||
* @see https://php.net/datetime.formats for the supported date/time formats
|
||||
*/
|
||||
public function find(?string $ip, ?string $url, ?int $limit, ?string $method, ?string $start, ?string $end, string $statusCode = null/* , \Closure $filter = null */): array
|
||||
public function find(?string $ip, ?string $url, ?int $limit, ?string $method, ?string $start, ?string $end, ?string $statusCode = null/* , \Closure $filter = null */): array
|
||||
{
|
||||
$filter = 7 < \func_num_args() ? func_get_arg(7) : null;
|
||||
|
||||
@@ -138,7 +138,7 @@ class Profiler implements ResetInterface
|
||||
/**
|
||||
* Collects data for the given Response.
|
||||
*/
|
||||
public function collect(Request $request, Response $response, \Throwable $exception = null): ?Profile
|
||||
public function collect(Request $request, Response $response, ?\Throwable $exception = null): ?Profile
|
||||
{
|
||||
if (false === $this->enabled) {
|
||||
return null;
|
||||
|
||||
@@ -35,7 +35,7 @@ interface ProfilerStorageInterface
|
||||
* @param string|null $statusCode The response status code
|
||||
* @param \Closure|null $filter A filter to apply on the list of tokens
|
||||
*/
|
||||
public function find(?string $ip, ?string $url, ?int $limit, ?string $method, int $start = null, int $end = null/* , string $statusCode = null, \Closure $filter = null */): array;
|
||||
public function find(?string $ip, ?string $url, ?int $limit, ?string $method, ?int $start = null, ?int $end = null/* , string $statusCode = null, \Closure $filter = null */): array;
|
||||
|
||||
/**
|
||||
* Reads data associated with the given token.
|
||||
|
||||
Reference in New Issue
Block a user