Skip to content

Commit

Permalink
refactored code
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed May 8, 2019
1 parent b2033a1 commit b4364aa
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/Symfony/Component/Console/Helper/QuestionHelper.php
Expand Up @@ -367,19 +367,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 b4364aa

Please sign in to comment.