update patch 1
This commit is contained in:
@@ -33,12 +33,12 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
public function __construct(string $dsn)
|
||||
{
|
||||
if (!str_starts_with($dsn, 'file:')) {
|
||||
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));
|
||||
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));
|
||||
throw new \RuntimeException(\sprintf('Unable to create the storage directory (%s).', $this->folder));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ class FileProfilerStorage implements ProfilerStorageInterface
|
||||
// Create directory
|
||||
$dir = \dirname($file);
|
||||
if (!is_dir($dir) && false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
|
||||
throw new \RuntimeException(sprintf('Unable to create the storage directory (%s).', $dir));
|
||||
throw new \RuntimeException(\sprintf('Unable to create the storage directory (%s).', $dir));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -20,7 +20,6 @@ use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface;
|
||||
*/
|
||||
class Profile
|
||||
{
|
||||
|
||||
/**
|
||||
* @var DataCollectorInterface[]
|
||||
*/
|
||||
@@ -207,7 +206,7 @@ class Profile
|
||||
public function getCollector(string $name): DataCollectorInterface
|
||||
{
|
||||
if (!isset($this->collectors[$name])) {
|
||||
throw new \InvalidArgumentException(sprintf('Collector "%s" does not exist.', $name));
|
||||
throw new \InvalidArgumentException(\sprintf('Collector "%s" does not exist.', $name));
|
||||
}
|
||||
|
||||
return $this->collectors[$name];
|
||||
|
||||
+2
-2
@@ -133,7 +133,7 @@ class Profiler implements ResetInterface
|
||||
return null;
|
||||
}
|
||||
|
||||
$profile = new Profile(substr(hash('xxh128', uniqid(mt_rand(), true)), 0, 6));
|
||||
$profile = new Profile(bin2hex(random_bytes(3)));
|
||||
$profile->setTime(time());
|
||||
$profile->setUrl($request->getUri());
|
||||
$profile->setMethod($request->getMethod());
|
||||
@@ -221,7 +221,7 @@ class Profiler implements ResetInterface
|
||||
public function get(string $name): DataCollectorInterface
|
||||
{
|
||||
if (!isset($this->collectors[$name])) {
|
||||
throw new \InvalidArgumentException(sprintf('Collector "%s" does not exist.', $name));
|
||||
throw new \InvalidArgumentException(\sprintf('Collector "%s" does not exist.', $name));
|
||||
}
|
||||
|
||||
return $this->collectors[$name];
|
||||
|
||||
Reference in New Issue
Block a user