Skip to content

Commit

Permalink
Merge branch '3.4' into 4.2
Browse files Browse the repository at this point in the history
* 3.4:
  refactored code
  • Loading branch information
fabpot committed May 8, 2019
2 parents c381423 + ad26ac2 commit 28e7360
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions Helper/QuestionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,19 +328,17 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu

private function mostRecentlyEnteredValue($entered)
{
$tempEntered = $entered;

// Determine the most recent value that the user entered
if (false !== strpos($entered, ',')) {
$choices = explode(',', $entered);
$lastChoice = trim($choices[\count($choices) - 1]);
if (false === strpos($entered, ',')) {
return $entered;
}

if (\strlen($lastChoice) > 0) {
$tempEntered = $lastChoice;
}
$choices = explode(',', $entered);
if (\strlen($lastChoice = trim($choices[\count($choices) - 1])) > 0) {
return $lastChoice;
}

return $tempEntered;
return $entered;
}

/**
Expand Down

0 comments on commit 28e7360

Please sign in to comment.