Skip to content

Commit

Permalink
Add prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
GDXbsv committed Sep 24, 2024
1 parent 597d92d commit a15769a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit a15769a

Please sign in to comment.