Skip to content

Commit cb5c203

Browse files
committed
Compute md5 once in Colors::width().
1 parent 5ee4f23 commit cb5c203

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/cli/Colors.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,9 @@ static public function length($string) {
195195
* @return int
196196
*/
197197
static public function width($string) {
198-
if (isset(self::$_string_cache[md5($string)]['decolorized'])) {
199-
$test_string = self::$_string_cache[md5($string)]['decolorized'];
198+
$md5 = md5($string);
199+
if (isset(self::$_string_cache[$md5]['decolorized'])) {
200+
$test_string = self::$_string_cache[$md5]['decolorized'];
200201
} else {
201202
$test_string = self::decolorize($string);
202203
}

0 commit comments

Comments
 (0)