src/MenuItem/SplitItem.php
public function getRows(MenuStyle $style, bool $selected = false) : array
    {
        $numberOfItems = count($this->items);

        if ($numberOfItems === 0) {
            throw new \RuntimeException(sprintf('There should be at least one item added to: %s', __CLASS__));
        }
        
        if (!$selected) {
            $this->setDefaultSelectedItem();
        }

        $length = $style->getDisplaysExtra()
            ? floor($style->getContentWidth() / $numberOfItems) - (mb_strlen($style->getItemExtra()) + 2)
            : floor($style->getContentWidth() / $numberOfItems);
        
        $length -= $this->gutter;
        $length = (int) $length;
        
        $missingLength = $style->getContentWidth() % $numberOfItems;
        
        return $this->buildRows(
            array_map(function ($index, $item) use ($selected, $length, $style) {
                $isSelected = $selected && $index === $this->selectedItemIndex;
                $marker = $item->canSelect()
                    ? sprintf('%s', $style->getMarker($isSelected))
                    : '';

                $itemExtra = '';
                if ($style->getDisplaysExtra()) {
                    $itemExtra = $item->showsItemExtra()
                        ? sprintf('  %s', $style->getItemExtra())
                        : sprintf('  %s', str_repeat(' ', mb_strlen($style->getItemExtra())));
                }

                return $this->buildCell(
                    explode(
                        "\n",
                        StringUtil::wordwrap(
                            sprintf('%s%s', $marker, $item->getText()),
                            $length,
                            sprintf("\n%s", str_repeat(' ', mb_strlen($marker)))
                        )
                    ),
                    $length,
                    $style,
                    $isSelected,
                    $itemExtra
                );
            }, array_keys($this->items), $this->items),
            $style,
            $missingLength,
            $length
        );
    }
public function getRows(MenuStyle $style, bool $selected = false) : array
    {
        $numberOfItems = count($this->items);

        if ($numberOfItems === 0) {
            throw new \RuntimeException(sprintf('There should be at least one item added to: %s', __CLASS__));
        }
        
        if (!$selected) {
            $this->setDefaultSelectedItem();
        }

        $length = $style->getDisplaysExtra()
            ? floor($style->getContentWidth() / $numberOfItems) - (mb_strlen($style->getItemExtra()) + 2)
            : floor($style->getContentWidth() / $numberOfItems);
        
        $length -= $this->gutter;
        $length = (int) $length;
        
        $missingLength = $style->getContentWidth() % $numberOfItems;
        
        return $this->buildRows(
            array_map(function ($index, $item) use ($selected, $length, $style) {
                $isSelected = $selected && $index === $this->selectedItemIndex;
                $marker = $item->canSelect()
                    ? sprintf('%s', $style->getMarker($isSelected))
                    : '';

                $itemExtra = '';
                if ($style->getDisplaysExtra()) {
                    $itemExtra = $item->showsItemExtra()
                        ? sprintf('  %s', $style->getItemExtra())
                        : sprintf('  %s', str_repeat(' ', mb_strlen($style->getItemExtra())));
                }

                return $this->buildCell(
                    explode(
                        "\n",
                        StringUtil::wordwrap(
                            sprintf('%s%s', $marker, $item->getText()),
                            $length,
                            sprintf("\n%s", str_repeat(' ', mb_strlen($marker)))
                        )
                    ),
                    $length,
                    $style,
                    $isSelected,
                    $itemExtra
                );
            }, array_keys($this->items), $this->items),
            $style,
            $missingLength,
            $length
        );
    }
The output text for the item