-
-
Notifications
You must be signed in to change notification settings - Fork 452
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Strip path prefixes on profile frames (#1568)
- Loading branch information
1 parent
c965f55
commit 15a028d
Showing
6 changed files
with
223 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Sentry\Util; | ||
|
||
use Sentry\Options; | ||
|
||
trait PrefixStripper | ||
{ | ||
/** | ||
* Removes from the given file path the specified prefixes in the SDK options. | ||
*/ | ||
protected function stripPrefixFromFilePath(?Options $options, string $filePath): string | ||
{ | ||
if (null === $options) { | ||
return $filePath; | ||
} | ||
|
||
foreach ($options->getPrefixes() as $prefix) { | ||
if (str_starts_with($filePath, $prefix)) { | ||
return mb_substr($filePath, mb_strlen($prefix)); | ||
} | ||
} | ||
|
||
return $filePath; | ||
} | ||
} |
Oops, something went wrong.