From 05d4ea5f265d60c0412b5a52494d6e2f6277bb36 Mon Sep 17 00:00:00 2001 From: aleksandr-velikanov Date: Wed, 11 Sep 2024 13:34:06 -0300 Subject: [PATCH] SUPESC-889 Move strings into constants --- .../GitHub/GitHubSourceCodeProvider.php | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Upgrade/Infrastructure/VersionControlSystem/SourceCodeProvider/GitHub/GitHubSourceCodeProvider.php b/src/Upgrade/Infrastructure/VersionControlSystem/SourceCodeProvider/GitHub/GitHubSourceCodeProvider.php index 78abcf4a..7689d58d 100644 --- a/src/Upgrade/Infrastructure/VersionControlSystem/SourceCodeProvider/GitHub/GitHubSourceCodeProvider.php +++ b/src/Upgrade/Infrastructure/VersionControlSystem/SourceCodeProvider/GitHub/GitHubSourceCodeProvider.php @@ -30,6 +30,21 @@ class GitHubSourceCodeProvider implements SourceCodeProviderInterface */ protected const NUMBER_KEY = 'number'; + /** + * @var string + */ + protected const STRING_STACK_TRACE = '[stacktrace]'; + + /** + * @var string + */ + protected const STRING_NUMBER_ONE = '#1'; + + /** + * @var string + */ + protected const STRING_TRACE_TRUNCATED = '[...trace truncated...]'; + /** * @var \Upgrade\Infrastructure\Configuration\ConfigurationProvider */ @@ -164,13 +179,13 @@ public function buildMessageWithTruncatedTrace(string $message): string return $message; } - $messageArray = explode('[stacktrace]', $message); + $messageArray = explode(self::STRING_STACK_TRACE, $message); if (!isset($messageArray[0]) || !isset($messageArray[1])) { return $message; } - $traceArray = explode('#1', $messageArray[1]); + $traceArray = explode(self::STRING_NUMBER_ONE, $messageArray[1]); if (!isset($traceArray[0])) { return $message; @@ -178,6 +193,6 @@ public function buildMessageWithTruncatedTrace(string $message): string return $messageArray[0] . $traceArray[0] - . ('[...trace truncated...]'); + . (self::STRING_TRACE_TRUNCATED); } }