-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add setText to Items + small AsciiArt fix #153
Conversation
Codecov Report
@@ Coverage Diff @@
## master #153 +/- ##
============================================
+ Coverage 95.85% 95.96% +0.11%
- Complexity 425 431 +6
============================================
Files 27 27
Lines 1303 1315 +12
============================================
+ Hits 1249 1262 +13
+ Misses 54 53 -1
Continue to review full report at Codecov.
|
src/MenuItem/MenuItemInterface.php
Outdated
/** | ||
* Set the raw string of text | ||
*/ | ||
public function setText(string $text) : void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't need to be on the interface, when you are changing the text you will know what item you are dealing with and therefore will know the methods, no need to change this.
src/MenuItem/SplitItem.php
Outdated
/** | ||
* Nothing to set with SplitItem | ||
*/ | ||
public function setText(string $text) : void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can remove this after removing from the interface.
test/MenuItem/SplitItemTest.php
Outdated
@@ -375,6 +375,14 @@ public function testGetTextThrowsAnException() : void | |||
|
|||
(new SplitItem([]))->getText(); | |||
} | |||
|
|||
public function testSetTextThrowsAnException() : void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can also remove this.
Allow to call
->setText()
directly on items to modify their content on the fly.Can be usefull to do stuff like this:
Also fixes when right spaces on AsciiArt caused it to overflow and fallback to alt text (and a test to look after it).
Example: