Skip to content

Commit e917b00

Browse files
Replace two calls to str_replace() by single strtr()
I've tested: str_replace() is slower than strtr() in this case
1 parent 216540f commit e917b00

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/internal/Magento/Framework/Phrase/Renderer/Translate.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ public function render(array $source, array $arguments)
5050
{
5151
$text = end($source);
5252
/* If phrase contains escaped quotes then use translation for phrase with non-escaped quote */
53-
$text = str_replace('\"', '"', $text);
54-
$text = str_replace("\\'", "'", $text);
53+
$text = strtr($text, ['\"' => '"', "\\'" => "'"]);
5554

5655
try {
5756
$data = $this->translator->getData();

0 commit comments

Comments
 (0)