diff --git a/examples/draw.php b/examples/draw.php index 647027a1..df9fc7d8 100644 --- a/examples/draw.php +++ b/examples/draw.php @@ -5,6 +5,7 @@ use PhpSchool\CliMenu\CliMenu; use PhpSchool\CliMenu\Builder\CliMenuBuilder; use PhpSchool\CliMenu\MenuItem\SplitItem; +use PhpSchool\CliMenu\Style\SelectableStyle; require_once(__DIR__ . '/../vendor/autoload.php'); @@ -39,8 +40,10 @@ ->setBorder(0) ->setMargin(2) ->setPadding(2, 5) - ->setSelectedMarker('') - ->setUnselectedMarker('') + ->modifySelectableStyle(function (SelectableStyle $style) { + $style->setSelectedMarker('') + ->setUnselectedMarker(''); + }) ->addAsciiArt('Draw your own art !') ->addLineBreak(); diff --git a/src/Builder/CliMenuBuilder.php b/src/Builder/CliMenuBuilder.php index 59f7deb2..67a1ac43 100644 --- a/src/Builder/CliMenuBuilder.php +++ b/src/Builder/CliMenuBuilder.php @@ -394,22 +394,6 @@ public function setMargin(int $margin) : self return $this; } - public function setUnselectedMarker(string $marker) : self - { - $this->style->setUnselectedMarker($marker); - $this->menu->getSelectableStyle()->setUnselectedMarker($marker); - - return $this; - } - - public function setSelectedMarker(string $marker) : self - { - $this->style->setSelectedMarker($marker); - $this->menu->getSelectableStyle()->setSelectedMarker($marker); - - return $this; - } - public function setItemExtra(string $extra) : self { $this->style->setItemExtra($extra); @@ -608,7 +592,10 @@ private function propagateStyles(CliMenu $menu, array $items = []) $item->setStyle(clone $menu->getRadioStyle()); } - if ($item instanceof SelectableItem + if (($item instanceof MenuMenuItem + || $item instanceof SelectableItem + || $item instanceof StaticItem + ) && !$item->getStyle()->hasChangedFromDefaults() ) { $item->setStyle(clone $menu->getSelectableStyle()); diff --git a/src/MenuItem/MenuMenuItem.php b/src/MenuItem/MenuMenuItem.php index a3d8527f..acd72c60 100644 --- a/src/MenuItem/MenuMenuItem.php +++ b/src/MenuItem/MenuMenuItem.php @@ -2,26 +2,80 @@ namespace PhpSchool\CliMenu\MenuItem; -use Assert\Assertion; use PhpSchool\CliMenu\CliMenu; +use PhpSchool\CliMenu\MenuStyle; +use PhpSchool\CliMenu\Util\StringUtil; +use PhpSchool\CliMenu\Style\SelectableStyle; /** * @author Michael Woodward */ class MenuMenuItem implements MenuItemInterface { - use SelectableTrait; + private $text = ''; + + private $showItemExtra = false; + + private $disabled = false; + + /** + * @var SelectableStyle; + */ + private $style; /** * @var CliMenu */ private $subMenu; - public function __construct(string $text, CliMenu $subMenu, bool $disabled = false) - { + public function __construct( + string $text, + CliMenu $subMenu, + bool $disabled = false + ) { $this->text = $text; $this->subMenu = $subMenu; $this->disabled = $disabled; + + $this->style = new SelectableStyle(); + } + + /** + * The output text for the item + */ + public function getRows(MenuStyle $style, bool $selected = false) : array + { + $marker = sprintf("%s", $this->style->getMarker($selected)); + + $length = $this->style->getDisplaysExtra() + ? $style->getContentWidth() - (mb_strlen($this->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, $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)), + $this->style->getItemExtra() + ) + : $text; + } + + return $text; + }, $rows, array_keys($rows)); } /** @@ -34,6 +88,18 @@ public function getSelectAction() : ?callable }; } + public function getStyle() : SelectableStyle + { + return $this->style; + } + + public function setStyle(SelectableStyle $style) : self + { + $this->style = $style; + + return $this; + } + /** * Return the raw string of text */ @@ -49,7 +115,36 @@ public function setText(string $text) : void { $this->text = $text; } - + + /** + * Can the item be selected + */ + public function canSelect() : bool + { + return !$this->disabled; + } + + public function showsItemExtra() : bool + { + return $this->showItemExtra; + } + + /** + * Enable showing item extra + */ + public function showItemExtra() : void + { + $this->showItemExtra = true; + } + + /** + * Disable showing item extra + */ + public function hideItemExtra() : void + { + $this->showItemExtra = false; + } + /** * Returns the sub menu */ diff --git a/src/MenuItem/SelectableTrait.php b/src/MenuItem/SelectableTrait.php deleted file mode 100644 index c162493a..00000000 --- a/src/MenuItem/SelectableTrait.php +++ /dev/null @@ -1,89 +0,0 @@ - - */ -trait SelectableTrait -{ - /** - * @var string - */ - private $text = ''; - - /** - * @var bool - */ - private $showItemExtra = false; - - /** - * @var bool - */ - private $disabled = false; - - /** - * The output text for the item - */ - public function getRows(MenuStyle $style, bool $selected = false) : array - { - $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, $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)); - } - - /** - * Can the item be selected - */ - public function canSelect() : bool - { - return !$this->disabled; - } - - public function showsItemExtra() : bool - { - return $this->showItemExtra; - } - - /** - * Enable showing item extra - */ - public function showItemExtra() : void - { - $this->showItemExtra = true; - } - - /** - * Disable showing item extra - */ - public function hideItemExtra() : void - { - $this->showItemExtra = false; - } -} diff --git a/src/MenuItem/SplitItem.php b/src/MenuItem/SplitItem.php index cca5a999..47765f52 100644 --- a/src/MenuItem/SplitItem.php +++ b/src/MenuItem/SplitItem.php @@ -117,13 +117,15 @@ public function getRows(MenuStyle $style, bool $selected = false) : array $this->setDefaultSelectedItem(); } - $length = $style->getDisplaysExtra() - ? floor($style->getContentWidth() / $numberOfItems) - (mb_strlen($style->getItemExtra()) + 2) + $largestItemExtra = $this->calculateItemExtra(); + + $length = $largestItemExtra > 0 + ? floor($style->getContentWidth() / $numberOfItems) - ($largestItemExtra + 2) : floor($style->getContentWidth() / $numberOfItems); - + $length -= $this->gutter; $length = (int) $length; - + $missingLength = $style->getContentWidth() % $numberOfItems; return $this->buildRows( @@ -131,13 +133,10 @@ public function getRows(MenuStyle $style, bool $selected = false) : array $isSelected = $selected && $index === $this->selectedItemIndex; if ($item instanceof CheckboxItem || $item instanceof RadioItem) { - $markerType = $item->getStyle()->getMarker($item->getChecked()); - $displaysExtra = $item->getStyle()->getDisplaysExtra(); - $itemExtraVal = $item->getStyle()->getItemExtra(); + $markerType = $item->getStyle()->getMarker($item->getChecked()); } else { - $markerType = $style->getMarker($isSelected); - $displaysExtra = $style->getDisplaysExtra(); - $itemExtraVal = $style->getItemExtra(); + /** @var MenuMenuItem|SelectableItem|StaticItem $item */ + $markerType = $item->getStyle()->getMarker($isSelected); } $marker = $item->canSelect() @@ -145,7 +144,8 @@ public function getRows(MenuStyle $style, bool $selected = false) : array : ''; $itemExtra = ''; - if ($displaysExtra) { + if ($item->getStyle()->getDisplaysExtra()) { + $itemExtraVal = $item->getStyle()->getItemExtra(); $itemExtra = $item->showsItemExtra() ? sprintf(' %s', $itemExtraVal) : sprintf(' %s', str_repeat(' ', mb_strlen($itemExtraVal))); @@ -166,15 +166,15 @@ public function getRows(MenuStyle $style, bool $selected = false) : array $itemExtra ); }, array_keys($this->items), $this->items), - $style, $missingLength, - $length + $length, + $largestItemExtra ); } - private function buildRows(array $cells, MenuStyle $style, int $missingLength, int $length) : array + private function buildRows(array $cells, int $missingLength, int $length, int $largestItemExtra) : array { - $extraPadLength = $style->getDisplaysExtra() ? 2 + mb_strlen($style->getItemExtra()) : 0; + $extraPadLength = $largestItemExtra > 0 ? 2 + $largestItemExtra : 0; return array_map( function ($i) use ($cells, $length, $missingLength, $extraPadLength) { @@ -325,4 +325,27 @@ public function getText() : string { throw new \BadMethodCallException(sprintf('Not supported on: %s', __CLASS__)); } + + /** + * Finds largest itemExtra value in items + */ + private function calculateItemExtra() : int + { + $largestItemExtra = 0; + + /** @var CheckboxItem|RadioItem|MenuMenuItem|SelectableItem|StaticItem $item */ + foreach ($this->items as $item) { + if (!$item->getStyle()->getDisplaysExtra()) { + continue; + } + + if (mb_strlen($item->getStyle()->getItemExtra()) < $largestItemExtra) { + continue; + } + + $largestItemExtra = mb_strlen($item->getStyle()->getItemExtra()); + } + + return $largestItemExtra; + } } diff --git a/src/MenuItem/StaticItem.php b/src/MenuItem/StaticItem.php index fc532a0f..afc4f974 100644 --- a/src/MenuItem/StaticItem.php +++ b/src/MenuItem/StaticItem.php @@ -2,9 +2,9 @@ namespace PhpSchool\CliMenu\MenuItem; -use Assert\Assertion; use PhpSchool\CliMenu\MenuStyle; use PhpSchool\CliMenu\Util\StringUtil; +use PhpSchool\CliMenu\Style\SelectableStyle; /** * @author Michael Woodward @@ -16,9 +16,16 @@ class StaticItem implements MenuItemInterface */ private $text; + /** + * @var SelectableStyle; + */ + private $style; + public function __construct(string $text) { $this->text = $text; + + $this->style = new SelectableStyle(); } /** @@ -45,6 +52,18 @@ public function getSelectAction() : ?callable return null; } + public function getStyle() : SelectableStyle + { + return $this->style; + } + + public function setStyle(SelectableStyle $style) : self + { + $this->style = $style; + + return $this; + } + /** * Return the raw string of text */ diff --git a/src/MenuStyle.php b/src/MenuStyle.php index 47329f9d..0bd09746 100644 --- a/src/MenuStyle.php +++ b/src/MenuStyle.php @@ -59,16 +59,6 @@ class MenuStyle */ protected $contentWidth; - /** - * @var string - */ - private $selectedMarker; - - /** - * @var string - */ - private $unselectedMarker; - /** * @var string */ @@ -156,8 +146,6 @@ class MenuStyle 'paddingTopBottom' => 1, 'paddingLeftRight' => 2, 'margin' => 2, - 'selectedMarker' => '● ', - 'unselectedMarker' => '○ ', 'itemExtra' => '✔', 'displaysExtra' => false, 'titleSeparator' => '=', @@ -227,8 +215,6 @@ public function __construct(Terminal $terminal = null) $this->setPaddingTopBottom(self::$defaultStyleValues['paddingTopBottom']); $this->setPaddingLeftRight(self::$defaultStyleValues['paddingLeftRight']); $this->setMargin(self::$defaultStyleValues['margin']); - $this->setSelectedMarker(self::$defaultStyleValues['selectedMarker']); - $this->setUnselectedMarker(self::$defaultStyleValues['unselectedMarker']); $this->setItemExtra(self::$defaultStyleValues['itemExtra']); $this->setDisplaysExtra(self::$defaultStyleValues['displaysExtra']); $this->setTitleSeparator(self::$defaultStyleValues['titleSeparator']); @@ -248,8 +234,6 @@ public function hasChangedFromDefaults() : bool $this->paddingTopBottom, $this->paddingLeftRight, $this->margin, - $this->selectedMarker, - $this->unselectedMarker, $this->itemExtra, $this->displaysExtra, $this->titleSeparator, @@ -525,38 +509,6 @@ public function getRightHandPadding(int $contentLength) : int return $rightPadding; } - public function getSelectedMarker() : string - { - return $this->selectedMarker; - } - - public function setSelectedMarker(string $marker) : self - { - $this->selectedMarker = $marker; - - return $this; - } - - public function getUnselectedMarker() : string - { - return $this->unselectedMarker; - } - - public function setUnselectedMarker(string $marker) : self - { - $this->unselectedMarker = $marker; - - return $this; - } - - /** - * Get the correct marker for the item - */ - public function getMarker(bool $selected) : string - { - return $selected ? $this->selectedMarker : $this->unselectedMarker; - } - public function setItemExtra(string $itemExtra) : self { $this->itemExtra = $itemExtra; diff --git a/test/Builder/CliMenuBuilderTest.php b/test/Builder/CliMenuBuilderTest.php index d62221ba..3c53cfad 100644 --- a/test/Builder/CliMenuBuilderTest.php +++ b/test/Builder/CliMenuBuilderTest.php @@ -66,8 +66,6 @@ public function testModifyStyles() : void $builder->setWidth(40); $builder->setPadding(4, 1); $builder->setMargin(4); - $builder->setUnselectedMarker('>'); - $builder->setSelectedMarker('x'); $builder->setItemExtra('*'); $builder->setTitleSeparator('-'); @@ -80,8 +78,6 @@ public function testModifyStyles() : void self::assertEquals(4, $style->getPaddingTopBottom()); self::assertEquals(1, $style->getPaddingLeftRight()); self::assertEquals(4, $style->getMargin()); - self::assertEquals('>', $style->getUnselectedMarker()); - self::assertEquals('x', $style->getSelectedMarker()); self::assertEquals('*', $style->getItemExtra()); self::assertEquals('-', $style->getTitleSeparator()); } diff --git a/test/MenuItem/MenuMenuItemTest.php b/test/MenuItem/MenuMenuItemTest.php index 16c03bd8..019a2cbe 100644 --- a/test/MenuItem/MenuMenuItemTest.php +++ b/test/MenuItem/MenuMenuItemTest.php @@ -55,11 +55,12 @@ public function testGetRows() : void $menuStyle = new MenuStyle($terminal); $menuStyle->setPaddingLeftRight(0); $menuStyle->setWidth(10); - $menuStyle->setUnselectedMarker('* '); $subMenu = $this->createMock(CliMenu::class); $item = new MenuMenuItem('Item', $subMenu); + $item->getStyle() + ->setUnselectedMarker('* '); $this->assertEquals(['* Item'], $item->getRows($menuStyle)); } @@ -71,11 +72,12 @@ public function testGetRowsWithUnSelectedMarker() : void $menuStyle = new MenuStyle($terminal); $menuStyle->setPaddingLeftRight(0); $menuStyle->setWidth(10); - $menuStyle->setUnselectedMarker('* '); $subMenu = $this->createMock(CliMenu::class); $item = new MenuMenuItem('Item', $subMenu); + $item->getStyle() + ->setUnselectedMarker('* '); $this->assertEquals(['* Item'], $item->getRows($menuStyle)); $this->assertEquals(['* Item'], $item->getRows($menuStyle, false)); } @@ -89,17 +91,13 @@ public function testGetRowsWithSelectedMarker() : void ->method('getContentWidth') ->will($this->returnValue(10)); - $menuStyle - ->expects($this->once()) - ->method('getMarker') - ->with(true) - ->will($this->returnValue('= ')); - $subMenu = $this->getMockBuilder(CliMenu::class) ->disableOriginalConstructor() ->getMock(); $item = new MenuMenuItem('Item', $subMenu); + $item->getStyle() + ->setSelectedMarker('= '); $this->assertEquals(['= Item'], $item->getRows($menuStyle, true)); } @@ -112,11 +110,12 @@ public function testGetRowsWithMultipleLines() : void $menuStyle = new MenuStyle($terminal); $menuStyle->setPaddingLeftRight(0); $menuStyle->setWidth(10); - $menuStyle->setUnselectedMarker('* '); $subMenu = $this->createMock(CliMenu::class); $item = new MenuMenuItem('LONG ITEM LINE', $subMenu); + $item->getStyle() + ->setUnselectedMarker('* '); $this->assertEquals( [ "* LONG", diff --git a/test/MenuItem/SplitItemTest.php b/test/MenuItem/SplitItemTest.php index f1d63252..b1748e01 100644 --- a/test/MenuItem/SplitItemTest.php +++ b/test/MenuItem/SplitItemTest.php @@ -12,6 +12,7 @@ use PhpSchool\CliMenu\MenuItem\SplitItem; use PhpSchool\CliMenu\MenuItem\StaticItem; use PhpSchool\CliMenu\MenuStyle; +use PhpSchool\CliMenu\Style\SelectableStyle; use PhpSchool\Terminal\Terminal; use PHPUnit\Framework\TestCase; @@ -193,17 +194,16 @@ public function testGetRowsWithOneItemSelected() : void ->method('getContentWidth') ->will($this->returnValue(30)); - $menuStyle - ->expects($this->any()) - ->method('getMarker') - ->willReturnMap([[true, '= '], [false, '* ']]); + $selectableStyle = (new SelectableStyle()) + ->setSelectedMarker('= ') + ->setUnselectedMarker('* '); $item = new SplitItem( [ - new SelectableItem('Item One', function () { - }), - new SelectableItem('Item Two', function () { - }) + (new SelectableItem('Item One', function () { + }))->setStyle($selectableStyle), + (new SelectableItem('Item Two', function () { + }))->setStyle($selectableStyle), ] ); @@ -241,18 +241,15 @@ public function testGetRowsWithMultipleLinesWithUnSelectedMarker() : void ->method('getContentWidth') ->will($this->returnValue(30)); - $menuStyle - ->expects($this->any()) - ->method('getMarker') - ->with(false) - ->will($this->returnValue('* ')); + $selectableStyle = (new SelectableStyle()) + ->setUnselectedMarker('* '); $item = new SplitItem( [ - new SelectableItem("Item\nOne", function () { - }), - new SelectableItem("Item\nTwo", function () { - }) + (new SelectableItem("Item\nOne", function () { + }))->setStyle($selectableStyle), + (new SelectableItem("Item\nTwo", function () { + }))->setStyle($selectableStyle), ] ); @@ -274,17 +271,16 @@ public function testGetRowsWithMultipleLinesWithOneItemSelected() : void ->method('getContentWidth') ->will($this->returnValue(30)); - $menuStyle - ->expects($this->any()) - ->method('getMarker') - ->willReturnMap([[true, '= '], [false, '* ']]); + $selectableStyle = (new SelectableStyle()) + ->setSelectedMarker('= ') + ->setUnselectedMarker('* '); $item = new SplitItem( [ - new SelectableItem("Item\nOne", function () { - }), - new SelectableItem("Item\nTwo", function () { - }) + (new SelectableItem("Item\nOne", function () { + }))->setStyle($selectableStyle), + (new SelectableItem("Item\nTwo", function () { + }))->setStyle($selectableStyle), ] ); @@ -307,19 +303,21 @@ public function testGetRowsWithItemExtra() : void $menuStyle = new MenuStyle($terminal); $menuStyle->setPaddingLeftRight(0); $menuStyle->setWidth(50); - $menuStyle->setItemExtra('[EXTRA]'); - $menuStyle->setDisplaysExtra(true); - $menuStyle->setUnselectedMarker('* '); + + $selectableStyle = (new SelectableStyle()) + ->setItemExtra('[EXTRA]') + ->setDisplaysExtra(true) + ->setUnselectedMarker('* '); $item = new SplitItem( [ - new SelectableItem('Item 1', function () { - }, true), - new SelectableItem('Item 2', function () { - }, true) + (new SelectableItem('Item 1', function () { + }, true))->setStyle($selectableStyle), + (new SelectableItem('Item 2', function () { + }, true))->setStyle($selectableStyle), ] ); - + self::assertEquals(['* Item 1 [EXTRA] * Item 2 [EXTRA] '], $item->getRows($menuStyle)); } @@ -331,16 +329,18 @@ public function testGetRowsWithMultipleLinesWithItemExtra() : void $menuStyle = new MenuStyle($terminal); $menuStyle->setPaddingLeftRight(0); $menuStyle->setWidth(50); - $menuStyle->setItemExtra(' [EXTRA]'); - $menuStyle->setDisplaysExtra(true); - $menuStyle->setUnselectedMarker('* '); + + $selectableStyle = (new SelectableStyle()) + ->setItemExtra('[EXTRA]') + ->setDisplaysExtra(true) + ->setUnselectedMarker('* '); $item = new SplitItem( [ - new SelectableItem("Item 1\nItem 1", function () { - }, true), - new SelectableItem("Item 2\nItem 2", function () { - }, true) + (new SelectableItem("Item 1\nItem 1", function () { + }, true))->setStyle($selectableStyle), + (new SelectableItem("Item 2\nItem 2", function () { + }, true))->setStyle($selectableStyle), ] ); @@ -361,16 +361,18 @@ public function testGetRowsWithMultipleLinesWithItemExtraOnOne() : void $menuStyle = new MenuStyle($terminal); $menuStyle->setPaddingLeftRight(0); $menuStyle->setWidth(50); - $menuStyle->setItemExtra(' [EXTRA] '); - $menuStyle->setDisplaysExtra(true); - $menuStyle->setUnselectedMarker('* '); + + $selectableStyle = (new SelectableStyle()) + ->setItemExtra(' [EXTRA] ') + ->setDisplaysExtra(true) + ->setUnselectedMarker('* '); $item = new SplitItem( [ - new SelectableItem("Item 1\nItem 1", function () { - }), - new SelectableItem("Item 2\nItem 2", function () { - }, true) + (new SelectableItem("Item 1\nItem 1", function () { + }))->setStyle($selectableStyle), + (new SelectableItem("Item 2\nItem 2", function () { + }, true))->setStyle($selectableStyle), ] ); diff --git a/test/MenuStyleTest.php b/test/MenuStyleTest.php index 1c954cc3..d593c949 100644 --- a/test/MenuStyleTest.php +++ b/test/MenuStyleTest.php @@ -81,8 +81,6 @@ public function testGetterAndSetters() : void self::assertSame('blue', $style->getBg()); self::assertSame('white', $style->getFg()); - self::assertSame('○ ', $style->getUnselectedMarker()); - self::assertSame('● ', $style->getSelectedMarker()); self::assertSame('✔', $style->getItemExtra()); self::assertFalse($style->getDisplaysExtra()); self::assertSame('=', $style->getTitleSeparator()); @@ -98,8 +96,6 @@ public function testGetterAndSetters() : void $style->setBg('red'); $style->setFg('yellow'); - $style->setUnselectedMarker('-'); - $style->setSelectedMarker('>'); $style->setItemExtra('EXTRA!'); $style->setDisplaysExtra(true); $style->setTitleSeparator('+'); @@ -115,8 +111,6 @@ public function testGetterAndSetters() : void self::assertSame('red', $style->getBg()); self::assertSame('yellow', $style->getFg()); - self::assertSame('-', $style->getUnselectedMarker()); - self::assertSame('>', $style->getSelectedMarker()); self::assertSame('EXTRA!', $style->getItemExtra()); self::assertTrue($style->getDisplaysExtra()); self::assertSame('+', $style->getTitleSeparator()); @@ -233,17 +227,6 @@ public function testSetBgThrowsExceptionWhenColourCodeIsNotInRange() : void $style->setBg(257, 'white'); } - public function testGetMarkerReturnsTheCorrectMarkers() : void - { - $style = $this->getMenuStyle(); - - $style->setSelectedMarker('>'); - $style->setUnselectedMarker('x'); - - static::assertSame('>', $style->getMarker(true)); - static::assertSame('x', $style->getMarker(false)); - } - public function testWidthCalculation() : void { $style = $this->getMenuStyle();