Finds the default address option.

@param string $type
The address type.
@param array $options
An array of address options.

@return string
The key of the default option.
488347
protected function getDefaultAddressOption($type, array $options) {
    $default_option = NULL;

    // Check if any address is a default for this type.
    foreach ($options as $option_id => $option) {
      $key = "default-{$type}";
      if (isset($option[$key]) && $option[$key]) {
        $default_option = $option_id;
        break;
      }
    }

    // Fallback to the first option.
    if (!$default_option || !isset($options[$default_option])) {
      $option_ids = array_keys($options);
      $default_option = reset($option_ids);
    }

    return $default_option;
  }
1060236
private function getFormat(array $options)
    {
        if (isset($options[self::PARAM_FORMAT])) {
            return $options[self::PARAM_FORMAT];
        } else {
            return $this->defaultFormat;
        }
    }
345210
public function getFromGateway($type) {
        $mapper = $this->config->getCcTypesMapper();
        $type   = strtolower($type);

        if( array_key_exists($type, $mapper) ) {
            return $mapper[$type];
        }

        return 'OT';
    }
802753
public static function createFromOptions(array $options)
    {
        Validate::notNull($options['AssetId'], 'options[AssetId]');
        Validate::notNull($options['AccessPolicyId'], 'options[AccessPolicyId]');
        Validate::notNull($options['Type'], 'options[Type]');

        $locator = new self(
            $options['AssetId'],
            $options['AccessPolicyId'],
            $options['Type']
        );
        $locator->fromArray($options);

        return $locator;
    }
466665
public function handleFlashAndRedirect($type, $options) {
		$this->_handleFlash($type, $options);

		return $this->_handleRedirect($type, $options);
	}
706012
protected function setDefaultOptions(array $options=[])
    {

        parent::setDefaultOptions($options);

        $this->defaultOptions['primary_key'] = $this->toModel->getKeyName();
    }
258841
public function getOption($key, $default = null)
    {
        $option = $this->getAttribute('options');

        if (! is_array($option)) {
            $option = [];
        }

        if (array_key_exists($key, $option)) {
            return $option[$key];
        }

        return $default;
    }
1120527
protected function getDefaultOptionValue(array $options, $steps, $default = 0)
    {
        $value = $options;
        $steps = explode('.', $steps);

        foreach ($steps as $step) {
            if (!array_key_exists($step, $value)) {
                return $default;
            }

            $value = $value[$step];
        }

        return $value;
    }
211189
public function send(string $type, array $options = []): bool
    {
        $type = $this->typeRegistry->get($type);
        $builder = MessageBuilder::fromType($type, $options);
        $message = ResolvedMessage::fromBuilder($builder);

        return $this->driver->send($message);
    }
1201749
public function setOptions(array $options): FieldTypeInterface
    {
        $l10n = $this->handleLocalization($options);

        $options = array_merge(
            $this->getDefaultOptions(),
            $this->options,
            $options
        );

        if (isset($options['l10n']) && ! empty($l10n)) {
            $options['l10n'] = array_merge($options['l10n'], $l10n);
        }

        $this->options = $this->parseOptions($options);

        return $this;
    }
1014449
public function get($key, $type = self::NORMAL, $default = null)
    {
        $typeConfig = $this->getTypeConfig($type);

        if (array_key_exists($key, $typeConfig)) {
            return $typeConfig[$key];
        }

        return $default;
    }
1126628
public function getDefault(string $type)
    {
        switch ($type) {
            case self::TYPE_NULL:
                return null;
            case self::TYPE_BOOLEAN:
                return false;
            case self::TYPE_INTEGER:
            case self::TYPE_FLOAT:
                return 0;
            case self::TYPE_STRING:
            case self::TYPE_BINARY:
                return '';
            case self::TYPE_ARRAY:
            case self::TYPE_OBJECT:
                return [];
        }

        throw new InvalidValueException("Invalid value type: $type");
    }
155583
private function getOptions(array $options, $defaultTemplate)
    {
        if (!array_key_exists('template', $options)) {
            $options['template'] = $defaultTemplate;
        }

        if (!array_key_exists('route', $options)) {
            $options['route'] = null;
        }

        if (!array_key_exists('route_params', $options)) {
            $options['route_params'] = [];
        }

        return $options;
    }
1006328
private function _options($options)
    {
        $result = array();

        // certain parameters have to occur first
        if (isset($options->unsigned)) {
            $result []= 'unsigned';
        }

        if (isset($options->zerofill)) {
            $result []= 'zerofill';
        }

        foreach ($options as $key=>$value) {
            switch ($key) {
                case 'primary':
                    $result [] = 'primary key';
                    break;

                case 'required':
                case 'notnull':
                    $result [] = 'not null';
                    break;

                case 'default':
                    $result []= sprintf("default '%s'", $value);
                    break;

                case 'sequence':
                case 'unsigned':
                case 'zerofill':
                case 'allowed':
                    break;

                default:
                    $result []= $key;
                    break;
            }
        }

        return implode(' ', $result);
    }
1048729
private function getDefaultValue(string $type)
    {
        $value = null;
        switch ($type) {
            case 'int':
                $value = 0;
                break;
            case 'string':
                $value = '';
                break;
            case 'bool':
                $value = false;
                break;
            case 'float':
                $value = 0;
                break;
            case 'double':
                $value = 0;
                break;
        }

        return $value;
    }
508664
public function setOptions(array $options) {
    foreach ($options as $key => $value) {
      if (is_int($key)) {
        $option  = '--' . $value;
      }
      elseif (strlen($key) == 1) {
        $option = '-' . $key;
        if (!empty($value)) {
          $option .= ' ' . escapeshellarg($value);
        }
      }
      else {
        // Do not render --uri=default.
        if ($key == 'uri' && $value == 'default') {
          continue;
        }
        $option = '--' . $key;
        if (!empty($value)) {
          $option .= '=' . escapeshellarg($value);
        }
      }
      if (!in_array($option, $this->options)) {
        $this->options[] = $option;
      }
    }
    return $this;
  }
1076560
protected function getDefault(int $type = Variables::TYPE_STRING)
    {
        switch ($type) {
            case Variables::TYPE_INT:
                $value = (int)0;
                break;
            case Variables::TYPE_FLOAT:
                $value = (float)0;
                break;
            case Variables::TYPE_STRING:
                $value = '';
                break;
            case Variables::TYPE_ARRAY:
                $value = [];
                break;
            case Variables::TYPE_JSON_DECODED:
                $value = '';
                break;
            case Variables::TYPE_AUTO:
                $value = '';
                break;
            default:
                throw new DomainException('Invalid variable type specified');
                break;
        }
        return $value;
    }