Multiple choices user select

@param User[] $choices
194286
protected function selector(&$choices = null)
    {
        $choices = $choices ? $choices : $this->choices;
        $choices = $this->userEditor->getChoicesAsEmailUsername($choices);
        $question = new ChoiceQuestion(static::PLEASE_SELECT_A_USER, $choices);
        $selectedUser = $this->ask($question);
        $user = $this->getChoiceBySelection($selectedUser);
        if ($user) {
            $this->editor($user);
        }
    }
526248
protected function parseChoices(array $choices)
    {
        $items = [];

        foreach ($choices as $key => $value) {
            if (is_array($value)) {
                // Handle options groups data.
                $items[] = ['key' => $key, 'value' => '', 'type' => 'group'];
                $items = array_merge($items, $this->parseChoices($value));
            } else {
                $items[] = ['key' => $key, 'value' => $value, 'type' => 'option'];
            }
        }

        return $items;
    }
93966
public function selected($values)
    {
        if (is_array($values) || $values instanceof Closure) {
            $this->selected = $values;
        }
        else if (func_num_args() > 1) {
            $this->selected = func_get_args();
        } else {
            $this->selected = [$values];
        }

        return $this;
    }
1115452
protected function resetSearchGroupChoices(array &$filteredChoices, $group, array $choices)
    {
        foreach ($choices as $key => $choice) {
            list($id, $label) = $this->getIdAndLabel($key, $choice);

            if (false !== stripos($label, $this->search) && !\in_array($id, $this->getIds())) {
                if (!array_key_exists($group, $filteredChoices)) {
                    $filteredChoices[$group] = [];
                }

                $filteredChoices[$group][$key] = $choice;
            }
        }
    }
1354266
protected static function paginateSimpleChoices(array $choices, $startTo, $endTo)
    {
        $paginatedChoices = [];
        $index = 0;

        foreach ($choices as $key => $choice) {
            if ($index >= $startTo && $index < $endTo) {
                $paginatedChoices[$key] = $choice;
            }

            ++$index;
        }

        return $paginatedChoices;
    }
76686
public function choice($question, array $choices, $default = null, $attempts = null, $multiple = null)
    {
        return $this->output->choice($question, $choices, $default, $attempts, $multiple);
    }
145256
protected function getIterativeUserSelectionModeChoices()
    {
        $choices = [];

        foreach ($this->context->output['models'] as $id => $model) {
            if (in_array($id, $this->modelsDone)) continue;

            $choices[] = $id . ': ' . $model['name'];
        }

        ksort($choices);

        return $choices;
    }
881761
private static function selectOptions(
        array $options = [],
        $actualValue = '',
        $multiple = false
    ) {
        $option = '';
        foreach ($options as $value => $label) {
            if (is_array($label)) {
                $option .= '<optgroup label="'. $value .'">';
                $option .= self::selectOptions($label, $actualValue, $multiple);
                $option .= '</optgroup>';
            } else {
                $selected = (!empty($value) && (
                    ($multiple === true && in_array($value, $actualValue)) ||
                    ($multiple === false && $value == $actualValue)
                )) ? ' selected' : '';
                $option .= '<option value="'. $value .'"'. $selected .'>'
                    . $label .'</option>';
            }
        }
        return $option;
    }
1357798
protected function parseChoices(array $choices)
    {
        $parsed = [];
        foreach ($choices as $choiceIdent => $choice) {
            $choice = $this->parseChoice($choice, (string)$choiceIdent);
            $choiceIdent = $choice['value'];

            $parsed[$choiceIdent] = $choice;
        }

        return $parsed;
    }
418887
public function defineOptions(array $defaults, array $userOptions = null, $recursive = false)
    {

        $this->options = $defaults;

        if ($userOptions)
            $this->mergeOptions($userOptions, $recursive);
    }
1031749
public function addChoices(array $choices)
    {
        foreach ($choices as $choiceIdent => $choice) {
            $this->addChoice($choiceIdent, $choice);
        }

        return $this;
    }
550117
protected function listOptions(array $choices, $default = null, bool $multi = false): self
    {
        if (!$this->isAssocChoice($choices)) {
            return $this->promptOptions($choices, $default);
        }

        $maxLen = \max(\array_map('strlen', \array_keys($choices)));

        foreach ($choices as $choice => $desc) {
            $this->writer->eol()->cyan(\str_pad("  [$choice]", $maxLen + 6))->comment($desc);
        }

        $label = $multi ? 'Choices (comma separated)' : 'Choice';

        $this->writer->eol()->yellow($label);

        return $this->promptOptions(\array_keys($choices), $default);
    }
573130
protected function set_choices() {
		$all_pages = get_pages();
		foreach ( $all_pages as $page ) {
			$this->choices[ $page->ID ] = $page->post_title;
		}
	}
1072446
protected function set_choices() {
		if ( ! is_array( $this->choices ) ) {
			$this->choices = [];
		}
		if ( ! isset( $this->choices['element'] ) ) {
			$this->choices['element'] = 'input';
		}
	}
26254
public function choice($question, array $choices, $default = null)
    {
        if ($default) {
            $values = array_flip($choices);
            $default = $values[$default];
        }

        $question = new ChoiceQuestion($question, $choices, $default);
        $question->setMultiselect(true);

        return $this->askQuestion($question);
    }
948767
public function choice($question, array $choices, $default = null, $attempts = null, $multiple = null)
    {
        return parent::choice($this->setTextPrompt($question), $choices, $default, $attempts, $multiple);
    }
1117822
protected function addNewTagsInChoices(array $choices, array $allChoices, array $values, $isGrouped)
    {
        foreach ($values as $value) {
            if (!\in_array($value, $allChoices)) {
                if ($isGrouped) {
                    $choices['-------'][$value] = $value;
                } else {
                    $choices[$value] = $value;
                }
            }
        }

        return $choices;
    }