Merge meta options.

@param string|array $meta
@param array        $options

@return array
354099
protected function merge($meta, array $options = []): array
    {
        if (is_array($meta) && empty($options)) {
            $options = $meta;
            $meta = null;
        }

        $options = array_merge(['includes' => [], 'excludes' => []], $options);

        foreach ($options as $key => $value) {
            $filtered = Arr::expand(array_flip($value));
            $parent = Arr::get($this->options, is_null($meta) ? $key : "{$key}.{$meta}", []);

            $options[$key] = array_keys(Arr::dot(array_merge_recursive($filtered, $parent)));
        }

        return $options;
    }
86462
protected static function _get_menu_item_fields( $meta ) {
		$fields = array_merge(
			array(
				array(
					'id'    => 'type',
					'label' => __( 'Type', 'menu-icons' ),
					'value' => $meta['type'],
				),
				array(
					'id'    => 'icon',
					'label' => __( 'Icon', 'menu-icons' ),
					'value' => $meta['icon'],
				),
			),
			Menu_Icons_Settings::get_settings_fields( $meta )
		);

		return $fields;
	}
1040138
public function meta(array $meta)
    {
        if (empty($meta)) {
            return [];
        }

        $result['meta'] = $meta;

        if (array_key_exists('pagination', $result['meta'])) {
            $result['links'] = $result['meta']['pagination']['links'];
            unset($result['meta']['pagination']['links']);
        }

        return $result;
    }
549623
private function mergeMetadata(EntityMetadata &$metadata = null, EntityMetadata $toAdd)
    {
        if (null === $metadata) {
            $metadata = clone $toAdd;
        } else {
            $metadata->merge($toAdd);
        }
    }
561851
public function options(array $options = [])
    {
        $this->options = $options;

        foreach ($this->meta as $name) {
            $this->filterMetaType($name);
        }

        return $this;
    }
1189977
public function mergeArgsAndParams(array $args, array $params = null)
    {

        if ($params) {
            foreach ($args as &$arg) {
                if (is_array($arg)) {
                    foreach ($params as &$param) {
                        if (is_array($param)) {
                            $arg = $param;
                            unset($param);
                            break;
                        }
                    }
                }
            }
        }

        if (is_array($params)) {
            return array_merge($args, $params);
        }

        return $args;
    }
162515
public function merge(MetaData $data): void
    {
        foreach ($data->toArray() as $key => $value) {
            $this->set($key, $value);
        }
    }
1205418
protected function _mergeOptions($options) {
		if (!is_array($options)) {
			$type = $options;
			if (!$type) {
				$type = 'info';
			}
			$options = [
				'type' => $type,
			];
		}

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

		if (isset($options['element']) && !isset($options['type'])) {
			$options['type'] = $options['element'];
		}

		$options += ['type' => 'info'];
		$options += ['element' => $options['type']];

		$options += (array)$this->getConfig();

		return $options;
	}
921991
def _merge_options_metadata(options, settings):
    """"""
    if not options:
        return options
    kwargs = options.kwargs
    if kwargs == gax.OPTION_INHERIT or 'metadata' not in kwargs:
        return options

    kwarg_meta_dict = {}
    merged_kwargs = options.kwargs.copy()
    for kwarg_meta in merged_kwargs['metadata']:
        kwarg_meta_dict[kwarg_meta[0].lower()] = kwarg_meta
    for kwarg_meta in settings.kwargs['metadata']:
        if kwarg_meta[0].lower() not in kwarg_meta_dict:
            merged_kwargs['metadata'].append(kwarg_meta)
    return gax.CallOptions(
        timeout=options.timeout, retry=options.retry,
        page_token=options.page_token,
        is_bundling=options.is_bundling,
        **merged_kwargs)
151238
protected function merge(array $base, array $merge): array
    {
        $options = array_merge($this->default_options, $base, $merge);
        $options = array_intersect_key($options, $this->default_options);

        foreach ($this->default_options as $_key => $_default_option_value) {
            if (!isset($options[$_key])) {
                $options[$_key] = $_default_option_value;
            } else {
                settype($options[$_key], gettype($_default_option_value));
            }
        } // unset($_key, $_default_option_value);

        return $options;
    }
560933
public function merge($array, $default=true)
    {
        $newarray = array();

        foreach ($array as $key=>$value) {
            $newKey = is_numeric($key) ? $value : $key;
            $newValue = is_numeric($key) ? true : $value;
            $newarray[$newKey] = $newValue;
        }

        $this->_options = array_merge($this->_options, $newarray);

        return $this;
    }
1105448
public void merge(ConfigurationMetadata metadata) {
		for (ItemMetadata additionalItem : metadata.getItems()) {
			mergeItemMetadata(additionalItem);
		}
		for (ItemHint itemHint : metadata.getHints()) {
			add(itemHint);
		}
	}
1073244
protected function mergeConfig($options)
    {
        $options = array_merge(
            $this->config->get('hipsupport::config'),
            $options
        );

        if (isset($options['notification'])
            and is_array($options['notification'])
        ) {
            $options['notification'] = array_merge(
                (array) $this->config->get('hipsupport::config.notification'),
                $options['notification']
            );
        }

        return $options;
    }
515688
protected function transformByMeta(string $meta, array $data, ...$parameters): array
    {
        $name = Str::singular($meta);
        $types = $this->options[$meta];

        if (empty($types)) {
            return $data;
        }

        foreach ($types as $type => $index) {
            if (is_array($type)) {
                continue;
            }

            $method = $name.Str::studly($type);

            if (method_exists($this, $method)) {
                $data = $this->{$method}($data, ...$parameters);
            }
        }

        return $data;
    }
193049
public function merge($options)
    {
        if (is_array($options)) {
            $this->options = array_merge_recursive($this->options, $options);
        } elseif ($options instanceof self) {
            $this->options = array_merge_recursive($this->options, $options->options);
        }
    }
248394
protected function addPropertyMetadata(PropertyMetadata $metadata, $name, array $option = [])
    {
        $obj = $this->getOption($name);
        $meta = new Metadata($name, $this->resolveOptions($obj, $option));
        if ($obj instanceof AdvancedVisibilityInterface) {
            $metadata->addAdvancedVisibility($meta);
        }
        if ($obj instanceof VisibilityInterface) {
            $metadata->addVisibility($meta);
        }
        if ($obj instanceof AccessorInterface) {
            $metadata->setAccessor($meta);
        }
        if ($obj instanceof NameConverterInterface) {
            $metadata->addNameConverter($meta);
        }

        return $this;
    }
1077917
protected function mergeOptions(array $options)
    {
        $defaults = $options + $this->defaultOptions;
        $defaults['params'] = [];
        if (!$defaults['filter_action'] || $this->application->input->{$defaults['method']}($defaults['action']) === $defaults['filter_action']) {
            //Action filter
            //cleaning post/get data
            foreach ($defaults['filters'] as $params => $column) {
                switch ($defaults['method']) {
                    case 'get':
                        if (isset($_GET[$params])) {
                            if (is_array($_GET[$params])) {
                                $_GET[$params] = array_filter(
                                    $_GET[$params],
                                    function ($value) {
                                        return (trim($value) !== '');
                                    }
                                );
                                if (empty($_GET[$params])) {
                                    unset($_GET[$params]);
                                }
                            } elseif (trim($_GET[$params]) === '') {
                                unset($_GET[$params]);
                            }
                        }
                        break;
                    case 'post':
                        if (isset($_POST[$params]) && trim($_POST[$params]) === '') {
                            if (is_array($_POST[$params])) {
                                $_POST[$params] = array_filter(
                                    $_POST[$params],
                                    function ($value) {
                                        return (trim($value) !== '');
                                    }
                                );
                                if (empty($_POST[$params])) {
                                    unset($_POST[$params]);
                                }
                            } elseif (trim($_POST[$params]) === '') {
                                unset($_POST[$params]);
                            }
                            unset($_POST[$params]);
                        }
                        break;
                }
            }
            $defaults['params'] = array_intersect_key($this->application->input->{$defaults['method']}(), $defaults['filters']);
        } elseif ($this->application->input->{$defaults['method']}($defaults['action']) === $defaults['reset_action']) {
            foreach ($defaults['filters'] as $params => $callback) {
                switch ($defaults['method']) {
                    case 'get':
                        unset($_GET[$params]);
                        break;
                    case 'post':
                        unset($_POST[$params]);
                        break;
                }
            }
            //Reset action
            $defaults['params'] = $defaults['default_filters'];
        } elseif ($defaults['save']) {
            $defaults['params'] = $this->application->session->userdata($options['save']);
        }

        // Si aucun filtre n'a été soumis (session non initialisé, filtre par défaut
        $session_exist = false;
        if ($defaults['save']) {
            $session_exist =  $this->application->session->has_userdata($options['save']);
        }
        if (empty($defaults['params']) && !$session_exist) {
             $defaults['params'] = $defaults['default_filters'];
        }
        return $defaults;
    }