/**
* Retrieves the requirements of the given template and asks the
* user for any parameters that are not available from the
* input, then binds the parameters to the template.
*
* @param TemplateInterface $template Template to render
*/
public function parameterize(TemplateInterface $template)
{
$params = [];
foreach ($template->getRequirements() as $key => $requirement) {
if (!$this->input->hasOption($key) || !$this->input->getOption($key)) {
list($prompt, $default) = $requirement;
if ('description' === $key) {
$v = $this->style->ask($prompt . ' (enter "e" to open editor)', $default);
if ('e' === $v) {
$editor = $this->getHelperSet()->get('editor');
$v = $editor->fromString('');
}
} else {
if ('branch' === $key && $this->input->hasOption('base') && $this->input->getOption('base')) {
$default = $this->input->getOption('base');
}
if (1 < count($choices = explode('|', $default))) {
$v = $this->style->choice($prompt . ' ', $choices, $choices[0]);
} else {
$v = $this->style->ask($prompt . ' ', $default);
}
}
} else {
$v = $this->input->getOption($key);
}
$params[$key] = $v;
}
$template->bind($params);
}