Skip to content

Adds alternateText to AsciiArtItem#93

Merged
AydinHassan merged 2 commits intophp-school:masterfrom
Lynesth:patch-11
May 2, 2018
Merged

Adds alternateText to AsciiArtItem#93
AydinHassan merged 2 commits intophp-school:masterfrom
Lynesth:patch-11

Conversation

@Lynesth
Copy link
Collaborator

@Lynesth Lynesth commented May 2, 2018

This will replace the AsciiArtItem with a StaticItem if the art is to big to fit in the menu/screen.

The new output will ignore position and be left aligned. Will print an empty line by default.

$asciiArtItem = new AsciiArtItem($art, $position);

if ($asciiArtItem->getArtLength() <= $this->getMenuStyle()->getContentWidth()) {
$this->addMenuItem($asciiArtItem);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be cleaner to just add a static item here instead? Then we wouldn't have to modify AsciiArtItem

Copy link
Collaborator Author

@Lynesth Lynesth May 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it wouldn't work if you first create the AsciiArtItem and then add it using addMenuItem().

Edit: That's why I went with this method.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok makes sense - I begin to think that the CliMenuBuilder was not such a good idea.

@AydinHassan AydinHassan merged commit c799acf into php-school:master May 2, 2018
@AydinHassan AydinHassan added this to the 3.0 milestone May 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants