php-school / cli-menu

🖥 Build beautiful PHP CLI menus. Simple yet Powerful. Expressive DSL.
http://www.phpschool.io
MIT License
1.94k stars 106 forks source link

Finalize SelectableStyle for items #216

Closed jtreminio closed 4 years ago

jtreminio commented 4 years ago

Related to #200

MenuStyle::$itemExtra should also be removed MenuStyle::$displaysExtra, as they are no longer used for anything. Will put that in a separate PR.

The only thing noteworthy in this particular PR is the addition of SplitItem::calculateItemExtra().

Since SplitItem does not contain its own styling, and markers/item extra are item-level now vs living in MenuStyle, this method loops through all items assigned to the split and finds the item with the largest item-extra value to calculate column sizes.

codecov-io commented 4 years ago

Codecov Report

Merging #216 into master will decrease coverage by 0.28%. The diff coverage is 89.39%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #216      +/-   ##
============================================
- Coverage     93.29%   93.01%   -0.29%     
- Complexity      589      591       +2     
============================================
  Files            31       30       -1     
  Lines          1760     1761       +1     
============================================
- Hits           1642     1638       -4     
- Misses          118      123       +5
Impacted Files Coverage Δ Complexity Δ
src/MenuStyle.php 96.8% <ø> (-0.2%) 64 <0> (-6)
src/MenuItem/StaticItem.php 100% <100%> (ø) 12 <2> (+2) :arrow_up:
src/Builder/CliMenuBuilder.php 77.17% <100%> (-0.56%) 89 <0> (ø)
src/MenuItem/MenuMenuItem.php 82.69% <83.78%> (+1.44%) 18 <12> (+11) :arrow_up:
src/MenuItem/SplitItem.php 99.27% <95%> (-0.73%) 49 <6> (+4)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 4992019...16f56b8. Read the comment docs.

AydinHassan commented 4 years ago

Thank you