From a15769aaa0a33e421c29da941f998c2cc2f0f4de Mon Sep 17 00:00:00 2001 From: "sergei.baikin" Date: Tue, 24 Sep 2024 14:24:25 +0200 Subject: [PATCH] Add prefix --- src/Endpoint.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Endpoint.php b/src/Endpoint.php index f8297ea..1372f05 100644 --- a/src/Endpoint.php +++ b/src/Endpoint.php @@ -9,34 +9,34 @@ */ final class Endpoint { - public static function web(string $dsnString): void + public static function web(string $dsnString, string $prefix = '/'): void { if ((isset($_GET['profile']) || isset($_GET['timer'])) && extension_loaded('excimer')) { $excimer = ExcimerS3::ofDsn($dsnString); if (isset($_GET['profile']) && is_string($_GET['profile'])) { $path = str_replace('__', '/', $_GET['profile']); - $excimer->trace($path); + $excimer->trace($prefix . '/' . $path); } if (isset($_GET['timer']) && is_string($_GET['timer'])) { $path = str_replace('__', '/', $_GET['timer']); - $excimer->timer($path); + $excimer->timer($prefix . '/' . $path); } } } - public static function cli(string $dsnString): void + public static function cli(string $dsnString, string $prefix = '/'): void { if (extension_loaded('excimer') && ((getenv("PROFILE") !== false) || (getenv("TIMER") !== false))) { $excimer = ExcimerS3::ofDsn($dsnString); $profilePath = getenv("PROFILE"); if (is_string($profilePath)) { $path = str_replace('__', '/', $profilePath); - $excimer->trace($path); + $excimer->trace($prefix . '/' . $path); } $timerPath = getenv("TIMER"); if (is_string($timerPath)) { $path = str_replace('__', '/', $timerPath); - $excimer->timer($path); + $excimer->timer($prefix . '/' . $path); } } }