Returns a context choice array.

@return string[]
510065
final protected function getContextChoices()
    {
        $contextChoices = [];
        /* @var ContextInterface $context */
        foreach ($this->contextManager->findAll() as $context) {
            $contextChoices[$context->getId()] = $context->getName();
        }

        return $contextChoices;
    }
1009856
public function getContextSelectorForm()
    {
        if (!$this->contextSelectorForm) {
            if (!$this->contextSelectorType || !$this->formFactory) {
                return null;
            }

            $formOptions = [
                'action' => $this->requestUri,
                'attr' => [
                    'novalidate' => 'novalidate',
                    'class' => 'form-inline',
                ],
            ];
            $this->contextSelectorForm = $this->formFactory->createNamed(
                static::SESSION_KEY,
                $this->contextSelectorType,
                $this->getContext(),
                $formOptions
            );
        }

        return $this->contextSelectorForm;
    }
960874
protected function getOptions()
    {
        $baseOptions = [
            ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'],
        ];

        return array_merge($baseOptions, isset($this->options) ? $this->options : []);
    }
1101962
public function getResultContext(): ?array
    {
        $context = $this->getConfiguration()->getOption('result_context');
        if ($context) {
            $context = array_merge($this->getFamily()->getContext(), (array) $context);
        }

        return $context;
    }
1120447
public static function values(): array
    {
        self::checkForChoiceEnumTraitMisuses();

        $values = array_keys(static::choices());

        if (is_a(static::class, FlaggedEnum::class, true)) {
            $values = array_values(array_filter($values, function ($v): bool {
                return 0 === ($v & $v - 1);
            }));
        }

        return $values;
    }
1369923
public function getOptions()
    {
        $options = array();

        $options['backgroundColor'] = $this->getBackgroundColor()->__toString();
        $options['padding'] = $this->getPadding();
        $options['colorSaturation'] = $this->getColorSaturation();
        $options['grayscaleSaturation'] = $this->getGrayscaleSaturation();
        $options['colorLightness'] = $this->getColorLightness();
        $options['grayscaleLightness'] = $this->getGrayscaleLightness();

        if ($this->hues !== null) {
            $options['hues'] = $this->getHues();
        }

        return $options;
    }
934925
public function get_contexts() : array {
        $contexts = [];
        foreach ($this->contextids as $contextid) {
            // It is possible that this context has been deleted and we now have subsequent calls being made with this
            // contextlist. Exceptions here will stop the further processing of this component and that is why we are
            // doing a try catch.
            try {
                $contexts[] = \context::instance_by_id($contextid);
            } catch (\Exception $e) {
                // Remove this context.
                unset($this->contextids[$this->iteratorposition]);
            }
        }

        return $contexts;
    }
126139
protected function getFactoryOptions(array $context): array
    {
        $options = [];

        if (isset($context[self::GROUPS])) {
            $options['serializer_groups'] = $context[self::GROUPS];
        }

        if (isset($context['collection_operation_name'])) {
            $options['collection_operation_name'] = $context['collection_operation_name'];
        }

        if (isset($context['item_operation_name'])) {
            $options['item_operation_name'] = $context['item_operation_name'];
        }

        return $options;
    }
26914
public function getOptions()
    {
        return [
            ['force', 'f', InputOption::VALUE_NONE, 'Force override existing files'],
            ['domain', false, InputOption::VALUE_NONE, 'Install in a subdomain'],
            ['lucid', false, InputOption::VALUE_NONE, 'Lucid architecture'],
            ['model', null, InputOption::VALUE_NONE, 'Exclude model and migration'],
            ['views', null, InputOption::VALUE_NONE, 'Exclude views'],
            ['routes', null, InputOption::VALUE_NONE, 'Exclude routes'],
        ];
    }
720224
public function getOptions()
    {
        $parentOptions = parent::getOptions();
        return array_merge($parentOptions, [
            ['lucid', false, InputOption::VALUE_NONE, 'Lucid architecture'],
            ['domain', false, InputOption::VALUE_NONE, 'Install in a subdomain'],
        ]);
    }
600566
public function choices()
    {
        if (empty($this->choices)) {
            $locales = $this->translator()->locales();
            if ($locales) {
                $selected = (array)$this->val();
                $choices  = [];

                foreach ($locales as $langCode => $localeStruct) {
                    /**
                     * @see \Charcoal\Admin\Widget\FormSidebarWidget::languages()
                     * @see \Charcoal\Admin\Widget\FormGroupWidget::languages()
                     */
                    if (isset($localeStruct['name'])) {
                        $label = $this->translator()->translation($localeStruct['name']);
                    } else {
                        $trans = 'locale.'.$langCode;
                        if ($trans === $this->translator()->translate($trans)) {
                            $label = strtoupper($langCode);
                        } else {
                            $label = $this->translator()->translation($trans);
                        }
                    }

                    $choices[$langCode] = [
                        'label'    => $label,
                        'selected' => in_array($langCode, $selected),
                        'value'    => $langCode
                    ];
                }

                $this->choices = $choices;
            }
        }

        return $this->choices;
    }
903620
public function getContext(): ?array
    {
        if ($this->currentRequest === null) {
            return null;
        }

        $controller = null;

        if ($route = $this->currentRequest->route()) {
            $controller = $route->controller;

            if (! $controller && ! is_string($route->action['uses'])) {
                $controller = $route->action['uses'];
            }
        }

        return [
            'uri' => $this->currentRequest->getUri(),
            'method' => $this->currentRequest->getMethod(),
            'controller' => $controller ? $this->cloner->cloneVar(class_basename($controller)) : $controller,
            'identifier' => spl_object_hash($this->currentRequest),
        ];
    }
1281181
protected function get_context_options() {
        if ($this->contextoptions === null) {
            $this->contextoptions = array();
            $displaylist = core_course_category::make_categories_list('moodle/cohort:manage');
            // We need to index the options array by context id instead of category id and add option for system context.
            $syscontext = context_system::instance();
            if (has_capability('moodle/cohort:manage', $syscontext)) {
                $this->contextoptions[$syscontext->id] = $syscontext->get_context_name();
            }
            foreach ($displaylist as $cid => $name) {
                $context = context_coursecat::instance($cid);
                $this->contextoptions[$context->id] = $name;
            }
        }
        return $this->contextoptions;
    }
22640
public function toOptionArray()
    {
        $options[] = ['label' => '', 'value' => ''];
        $availableOptions = $this->getAvailable();
        foreach ($availableOptions as $key => $value) {
            $options[] = [
                'label' => $value,
                'value' => $key,
            ];
        }

        return $options;
    }
654914
public function getAllOptions()
    {
        $result = [];

        foreach ($this->getOptionArray() as $index => $value) {
            $result[] = ['value' => $index, 'label' => $value];
        }

        return $result;
    }
933614
protected function getPHPActionOption() : array
    {
        $result = [];
        $answer = $this->io->askAndValidate(
            '  <info>Specify options key and value</info> <comment>[key:value]</comment> ',
            ['\\CaptainHook\\App\\Runner\\Config\\Setup\\Guided', 'isPHPActionOptionValid'],
            3,
            null
        );
        if (null !== $answer) {
            list($key, $value) = explode(':', $answer);
            $result = [$key => $value];
        }
        return $result;
    }
1066233
public function getAllOptions()
    {
        $result = [];

        foreach (self::getOptionArray() as $index => $value) {
            $result[] = ['value' => $index, 'label' => $value];
        }

        return $result;
    }