public function getRows(MenuStyle $style, $selected = false)
{
$marker = sprintf("%s ", $style->getMarker($selected));
$length = $style->getDisplaysExtra() ? $style->getContentWidth() - (mb_strlen($style->getItemExtra()) + 2) : $style->getContentWidth();
$rows = explode("\n", StringUtil::wordwrap(sprintf('%s%s', $marker, $this->text), $length, sprintf("\n%s", str_repeat(' ', mb_strlen($marker)))));
return array_map(function ($row, $key) use($style, $marker, $length) {
$text = $this->disabled ? $style->getDisabledItemText($row) : $row;
if ($key === 0) {
return $this->showItemExtra ? sprintf('%s%s %s', $text, str_repeat(' ', $length - mb_strlen($row)), $style->getItemExtra()) : $text;
}
return $text;
}, $rows, array_keys($rows));
}