protected function drawMenuItem(MenuItemInterface $item, bool $selected = false) : array
    {
        $rows = $item->getRows($this->style, $selected);
        
        if ($item instanceof SplitItem) {
            $selected = false;
        }

        $invertedColoursSetCode = $selected
            ? $this->style->getInvertedColoursSetCode()
            : '';
        $invertedColoursUnsetCode = $selected
            ? $this->style->getInvertedColoursUnsetCode()
            : '';

        if ($this->style->getBorderLeftWidth() || $this->style->getBorderRightWidth()) {
            $borderColour = $this->style->getBorderColourCode();
        } else {
            $borderColour = '';
        }

        return array_map(function ($row) use ($invertedColoursSetCode, $invertedColoursUnsetCode, $borderColour) {
            return sprintf(
                "%s%s%s%s%s%s%s%s%s%s%s%s\n",
                str_repeat(' ', $this->style->getMargin()),
                $borderColour,
                str_repeat(' ', $this->style->getBorderLeftWidth()),
                $this->style->getColoursSetCode(),
                $invertedColoursSetCode,
                str_repeat(' ', $this->style->getPaddingLeftRight()),
                $row,
                str_repeat(' ', $this->style->getRightHandPadding(mb_strlen(s::stripAnsiEscapeSequence($row)))),
                $invertedColoursUnsetCode,
                $borderColour,
                str_repeat(' ', $this->style->getBorderRightWidth()),
                $this->style->getColoursResetCode()
            );
        }, $rows);
    }
protected function drawMenuItem(MenuItemInterface $item, bool $selected = false) : array
    {
        $rows = $item->getRows($this->style, $selected);
        
        if ($item instanceof SplitItem) {
            $selected = false;
        }

        $invertedColoursSetCode = $selected
            ? $this->style->getInvertedColoursSetCode()
            : '';
        $invertedColoursUnsetCode = $selected
            ? $this->style->getInvertedColoursUnsetCode()
            : '';

        if ($this->style->getBorderLeftWidth() || $this->style->getBorderRightWidth()) {
            $borderColour = $this->style->getBorderColourCode();
        } else {
            $borderColour = '';
        }

        return array_map(function ($row) use ($invertedColoursSetCode, $invertedColoursUnsetCode, $borderColour) {
            return sprintf(
                "%s%s%s%s%s%s%s%s%s%s%s%s\n",
                str_repeat(' ', $this->style->getMargin()),
                $borderColour,
                str_repeat(' ', $this->style->getBorderLeftWidth()),
                $this->style->getColoursSetCode(),
                $invertedColoursSetCode,
                str_repeat(' ', $this->style->getPaddingLeftRight()),
                $row,
                str_repeat(' ', $this->style->getRightHandPadding(mb_strlen(s::stripAnsiEscapeSequence($row)))),
                $invertedColoursUnsetCode,
                $borderColour,
                str_repeat(' ', $this->style->getBorderRightWidth()),
                $this->style->getColoursResetCode()
            );
        }, $rows);
    }
protected function drawMenuItem ( MenuItemInterface $ item , bool $ selected = false ) : array { $ rows = $ item -> getRows ( $ this -> style , $ selected ) ; if ( $ item instanceof SplitItem ) { $ selected = false ; } $ invertedColoursSetCode = $ selected ? $ this -> style -> getInvertedColoursSetCode ( ) : '' ; $ invertedColoursUnsetCode = $ selected ? $ this -> style -> getInvertedColoursUnsetCode ( ) : '' ; if ( $ this -> style -> getBorderLeftWidth ( ) || $ this -> style -> getBorderRightWidth ( ) ) { $ borderColour = $ this -> style -> getBorderColourCode ( ) ; } else { $ borderColour = '' ; } return array_map ( function ( $ row ) use ( $ invertedColoursSetCode , $ invertedColoursUnsetCode , $ borderColour ) { return sprintf ( "%s%s%s%s%s%s%s%s%s%s%s%s\n" , str_repeat ( ' ' , $ this -> style -> getMargin ( ) ) , $ borderColour , str_repeat ( ' ' , $ this -> style -> getBorderLeftWidth ( ) ) , $ this -> style -> getColoursSetCode ( ) , $ invertedColoursSetCode , str_repeat ( ' ' , $ this -> style -> getPaddingLeftRight ( ) ) , $ row , str_repeat ( ' ' , $ this -> style -> getRightHandPadding ( mb_strlen ( s :: stripAnsiEscapeSequence ( $ row ) ) ) ) , $ invertedColoursUnsetCode , $ borderColour , str_repeat ( ' ' , $ this -> style -> getBorderRightWidth ( ) ) , $ this -> style -> getColoursResetCode ( ) ) ; } , $ rows ) ; }
Draw a menu item
Draw a menu item