Skip to content

Commit b5f319b

Browse files
authored
Fix right spaces causing fallback to alt text
1 parent 961c848 commit b5f319b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/MenuItem/AsciiArtItem.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(string $text, string $position = self::POSITION_CENT
4444
$this->setText($text);
4545
$this->position = $position;
4646
$this->alternateText = $alt;
47-
$this->artLength = max(array_map('mb_strlen', explode("\n", $text)));
47+
$this->calculateArtLength();
4848
}
4949

5050
/**
@@ -111,6 +111,14 @@ public function setText(string $text) : void
111111
}, explode("\n", $text)));
112112
}
113113

114+
/**
115+
* Calculate the length of the art
116+
*/
117+
private function calculateArtLength() : void
118+
{
119+
$this->artLength = max(array_map('mb_strlen', explode("\n", $this->text)));
120+
}
121+
114122
/**
115123
* Return the length of the art
116124
*/

0 commit comments

Comments
 (0)