Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Added Checkbox Console Prompt and its tests #7091

Merged
merged 10 commits into from
Feb 24, 2015

Conversation

Lansoweb
Copy link
Contributor

@Lansoweb Lansoweb commented Jan 1, 2015

Adding a new console prompt similar to the Select, but can select more than one option and returns an array with them.

* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
Copy link
Contributor

Choose a reason for hiding this comment

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

2015 ;)

$this->setPromptText($promptText);
}

if (! count($options)) {
Copy link
Member

Choose a reason for hiding this comment

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

Can simply be if (! $options) {

Copy link
Member

Choose a reason for hiding this comment

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

Should probably be handled by the setter

*/
private function setOptions($options)
{
if (! is_array($options) && ! $options instanceof \Traversable) {
Copy link
Member

Choose a reason for hiding this comment

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

The console component depends on zendframework/zend-stdlib, so you can safely use ArrayUtils::iteratorToArray() here and let it deal with the conversion/traversal instead

@Ocramius
Copy link
Member

Ocramius commented Jan 1, 2015

Besides the review/comments: awesome! :-)

@Lansoweb
Copy link
Contributor Author

Lansoweb commented Jan 1, 2015

Yeah, sorry about so many things. Just copied the Select one and made it accepting multiple options. Will rewrite it as instructed :-)

@Ocramius
Copy link
Member

Ocramius commented Jan 1, 2015

sorry about so many things

It's fine, it's my part of the process to review everything, so those get actually caught ;-)
The implementation just needed some cleanups, that's it. Poke me again if you need another round of reviews.

@Lansoweb
Copy link
Contributor Author

Lansoweb commented Jan 1, 2015

Besides the review/comments: awesome! :-)

Thanks! Glad to help.

@Lansoweb
Copy link
Contributor Author

Lansoweb commented Jan 1, 2015

@Ocramius Guess i'm done here. Care a last review? :-)
What's the best way to contact you? Want to talk about contribution.

@Ocramius
Copy link
Member

Ocramius commented Jan 2, 2015

What's the best way to contact you?

Just send me an email or catch me on IRC on freenode ( #zftalk )

/**
* @var string
*/
protected $promptText = 'Please select an option (Enter to finish) ';
Copy link
Member

Choose a reason for hiding this comment

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

All these can be private in my opinion

/**
* @return array
*/
private function getOptions()
Copy link
Member

Choose a reason for hiding this comment

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

To be removed as well

@Lansoweb
Copy link
Contributor Author

Lansoweb commented Jan 2, 2015

@Ocramius Done.

@Ocramius
Copy link
Member

Ocramius commented Jan 2, 2015

Looks good! Will pull locally and merge as soon as I can.

@Lansoweb
Copy link
Contributor Author

Lansoweb commented Jan 2, 2015

Ok. I will be more careful with the code next time :-) Sorry.

@Ocramius
Copy link
Member

Ocramius commented Jan 2, 2015

@Lansoweb this PR was actually quite clean! No need to be sorry: it's good work!

Also, you can always expect some nitpicking by me :-)

Removing unnecessary variable, fixing showResponse call
@weierophinney weierophinney merged commit cbe91b2 into zendframework:develop Feb 24, 2015
weierophinney added a commit that referenced this pull request Feb 24, 2015
Added Checkbox Console Prompt and its tests
weierophinney added a commit that referenced this pull request Feb 24, 2015
weierophinney added a commit to zendframework/zend-console that referenced this pull request May 15, 2015
…elop

Added Checkbox Console Prompt and its tests
weierophinney added a commit to zendframework/zend-console that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants