Skip to content
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

Allow preparing of subMenus #85

Merged
merged 2 commits into from
May 1, 2018
Merged

Conversation

Lynesth
Copy link
Collaborator

@Lynesth Lynesth commented May 1, 2018

This allows passing another CliMenuBuilder as the second argument of CliMenuBuilder::addSubMenu().

Why this request ? Because I think it gives more control for custom menus and I think it's easier to write more organized code that way.

Usage example:

$subMenu1 = (new CliMenuBuilder)
    ->setTitle('Some title')
    -> ... ; // No ->build() at the end !

$subMenu2 = (new CliMenuBuilder)
    ->setTitle('Some other title')
    -> ... ; // No ->build() at the end !

$mainMenu = (new CliMenuBuilder)
    ->setTitle('My awesome menu')
    ->addSubMenu('menu1', $subMenu1)
    ->addSubMenu('menu2', $subMenu2)
    ->build();

This allows passing another CliMenuBuilder as the second argument of CliMenuBuilder::addSubMenu().
@codecov-io
Copy link

codecov-io commented May 1, 2018

Codecov Report

Merging #85 into master will decrease coverage by 0.32%.
The diff coverage is 57.14%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #85      +/-   ##
============================================
- Coverage     96.47%   96.14%   -0.33%     
- Complexity      278      279       +1     
============================================
  Files            22       22              
  Lines           879      883       +4     
============================================
+ Hits            848      849       +1     
- Misses           31       34       +3
Impacted Files Coverage Δ Complexity Δ
src/CliMenuBuilder.php 96.47% <57.14%> (-2.08%) 44 <2> (+1)

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 4c883fb...700765f. Read the comment docs.

@AydinHassan
Copy link
Member

Seems reasonable enough to me. Thanks @Lynesth - I will add some tests and docs.

@AydinHassan AydinHassan merged commit 1701b32 into php-school:master May 1, 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.

3 participants