コード例 #1
0
 /**
  * Return array of options as value-label pairs
  *
  * @return array Format: array(array('value' => '<value>', 'label' => '<label>'), ...)
  */
 public function toOptionArray()
 {
     $adapters = [];
     foreach ($this->config->getAvailableAdapters() as $adapterName => $adapter) {
         $adapters[$adapterName] = ['value' => $adapterName, 'label' => $adapter['label']];
     }
     return $adapters;
 }
コード例 #2
0
 /**
  * AddressRequest constructor.
  *
  * @param array $params
  * @param ConfigInterface $config
  */
 public function __construct(array $params, ConfigInterface $config)
 {
     static $indexes = [AddressInterface::KEY_COUNTRY_ID => 'countryId', AddressInterface::KEY_REGION_ID => 'regionId', AddressInterface::KEY_REGION => 'region', AddressInterface::KEY_REGION_CODE => 'regionCode', AddressInterface::KEY_POSTCODE => 'postCode', AddressInterface::KEY_CITY => 'city', AddressInterface::KEY_STREET => 'streets'];
     foreach ($indexes as $index => $property) {
         if (!empty($params[$index])) {
             $this->{$property} = $params[$index];
         }
     }
     $this->maxSuggestions = $config->getMaxSuggestions();
 }