/** * Get options for given keys. * * `$key => $title` map. * * @param array $keys * * @return array */ public function titlesForOptions(array $keys) { $cacheKey = $this->cacheKey($keys); return $this->remember($cacheKey, function () use($keys) { return $this->provider->titlesForOptions($keys); }); }
/** * @return Option[]|array */ public function options() { $data = []; if ($this->prompt) { $data[] = new Option(null, $this->prompt); } $options = array_keys($this->filter->getOptions()); if (in_array(BasicProperty::NULL_VALUE, $options)) { $data[] = $this->makeOption($this->getNullValueLabel(), BasicProperty::NULL_VALUE); } if ($this->titlesProvider) { $options = $this->titlesProvider->titlesForOptions($options); } else { sort($options); $options = array_combine($options, $options); } foreach ($options as $value => $title) { $data[] = $this->makeOption($title, $value); } return $data; }