Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/console/Question/ChoiceQuestion.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 1fec387a4317 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
142 if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) { | 142 if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) { |
143 throw new InvalidArgumentException(sprintf($errorMessage, $selected)); | 143 throw new InvalidArgumentException(sprintf($errorMessage, $selected)); |
144 } | 144 } |
145 $selectedChoices = explode(',', $selectedChoices); | 145 $selectedChoices = explode(',', $selectedChoices); |
146 } else { | 146 } else { |
147 $selectedChoices = array($selected); | 147 $selectedChoices = [$selected]; |
148 } | 148 } |
149 | 149 |
150 $multiselectChoices = array(); | 150 $multiselectChoices = []; |
151 foreach ($selectedChoices as $value) { | 151 foreach ($selectedChoices as $value) { |
152 $results = array(); | 152 $results = []; |
153 foreach ($choices as $key => $choice) { | 153 foreach ($choices as $key => $choice) { |
154 if ($choice === $value) { | 154 if ($choice === $value) { |
155 $results[] = $key; | 155 $results[] = $key; |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 if (count($results) > 1) { | 159 if (\count($results) > 1) { |
160 throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results))); | 160 throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results))); |
161 } | 161 } |
162 | 162 |
163 $result = array_search($value, $choices); | 163 $result = array_search($value, $choices); |
164 | 164 |