Skip to content

Commit 4cb02ae

Browse files
committed
Generators/Text: minor simplification
No need for multiple calls to `str_replace()` when a single call will do.
1 parent f117c2b commit 4cb02ae

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Generators/Text.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ protected function getFormattedTextBlock(DOMNode $node)
130130
}
131131

132132
$text = trim($text);
133-
$text = str_replace('<em>', '*', $text);
134-
$text = str_replace('</em>', '*', $text);
133+
$text = str_replace(['<em>', '</em>'], '*', $text);
135134

136135
$nodeLines = explode("\n", $text);
137136
$lines = [];
@@ -243,8 +242,7 @@ protected function getFormattedCodeComparisonBlock(DOMNode $node)
243242
$firstTitleLines[] = $tempTitle;
244243
}
245244

246-
$first = str_replace('<em>', '', $first);
247-
$first = str_replace('</em>', '', $first);
245+
$first = str_replace(['<em>', '</em>'], '', $first);
248246
$firstLines = explode("\n", $first);
249247

250248
$second = trim($secondCodeElm->nodeValue);
@@ -278,8 +276,7 @@ protected function getFormattedCodeComparisonBlock(DOMNode $node)
278276
$secondTitleLines[] = $tempTitle;
279277
}
280278

281-
$second = str_replace('<em>', '', $second);
282-
$second = str_replace('</em>', '', $second);
279+
$second = str_replace(['<em>', '</em>'], '', $second);
283280
$secondLines = explode("\n", $second);
284281

285282
$titleRow = '';

0 commit comments

Comments
 (0)