PhpSchool\CliMenu\MenuStyle::getRightHandPadding PHP Method

getRightHandPadding() public method

Get padding for right had side of content
public getRightHandPadding ( $contentLength ) : integer
$contentLength
return integer
    public function getRightHandPadding($contentLength)
    {
        return $this->getContentWidth() - $contentLength + $this->getPadding();
    }

Usage Example

Example #1
0
 /**
  * Draw a menu item
  *
  * @param MenuItemInterface $item
  * @param bool|false $selected
  * @return array
  */
 protected function drawMenuItem(MenuItemInterface $item, $selected = false)
 {
     $rows = $item->getRows($this->style, $selected);
     $setColour = $selected ? $this->style->getSelectedSetCode() : $this->style->getUnselectedSetCode();
     $unsetColour = $selected ? $this->style->getSelectedUnsetCode() : $this->style->getUnselectedUnsetCode();
     return array_map(function ($row) use($setColour, $unsetColour) {
         return sprintf("%s%s%s%s%s%s%s\n\r", str_repeat(' ', $this->style->getMargin()), $setColour, str_repeat(' ', $this->style->getPadding()), $row, str_repeat(' ', $this->style->getRightHandPadding(mb_strlen(s::stripAnsiEscapeSequence($row)))), $unsetColour, str_repeat(' ', $this->style->getMargin()));
     }, $rows);
 }
All Usage Examples Of PhpSchool\CliMenu\MenuStyle::getRightHandPadding