Merge types from an array

@param array $types
@return bool
15727
public function mergeTypes( $types )
	{
		$this->types			= array_merge( $this->types, $types['types'] );
		$this->attributes		= array_merge( $this->attributes, $types['attributes'] );
		$this->attributeGroups	= array_merge( $this->attributeGroups, $types['attributeGroups'] );
		$this->elements			= array_merge( $this->elements, $types['elements'] );
		$this->processedSchemas	= array_merge( $this->processedSchemas, $types['processedSchemas'] );
		if ( isset( $types['typeIds'] ) )
		{
			$this->typeIds		= array_merge( $this->typeIds, $types['typeIds'] );
		}

		// Prevent re-loading base types
		$this->baseTypesLoaded = true;

		return true;
	}
1014651
public function merge(array $config, $type)
    {
        foreach ($config as $key => $val) {
            $this->set($key, $val, $type);
        }
    }
1359408
private function merge(array $files)
    {
        $content = '';

        foreach ($files as $file) {
            $content .= file_get_contents($this->basePath . $file);
        }

        return $content;
    }
903851
public function merge(array $a, array $b)
    {
        foreach ($b as $key => $value) {
            if (array_key_exists($key, $a)) {
                if (is_int($key)) {
                    $a[] = $value;
                } elseif (is_array($value) && is_array($a[$key])) {
                    $a[$key] = $this->merge($a[$key], $value);
                } else {
                    $a[$key] = $value;
                }
            } else {
                $a[$key] = $value;
            }
        }

        return $a;
    }
660434
public function setAutowiringTypes(array $types)
    {
        $this->autowiringTypes = array();

        foreach ($types as $type) {
            $this->autowiringTypes[$type] = true;
        }

        return $this;
    }
15059
protected function removeImpossibleArraySubtypes(array $types): array
    {
        $subTypes = $this->getSubTypes();

        if (count($subTypes) === 0) {
            return $types;
        }

        $subHandler = $this->setTypes($subTypes);

        foreach ($this->value as $item) {
            $subHandler = $subHandler->setTypes($subHandler->getPossibleTypes($item));
        }

        $possibleSubTypes = $subHandler->types;

        return count($possibleSubTypes) === count($subTypes)
            ? $types
            : array_filter($types, function($type) use ($possibleSubTypes) {
                return substr($type, -2) !== '[]' || in_array(substr($type, 0, -2), $possibleSubTypes);
            });
    }
1330116
public function merge($actions)
	{
		if (is_string($actions))
		{
			$actions = json_decode($actions, true);
		}

		if (is_array($actions))
		{
			foreach ($actions as $action => $identities)
			{
				$this->mergeAction($action, $identities);
			}
		}
		elseif ($actions instanceof Rules)
		{
			$data = $actions->getData();

			foreach ($data as $name => $identities)
			{
				$this->mergeAction($name, $identities);
			}
		}
	}
620538
private function merge(array $merged, array $array)
    {
        foreach ($array as $key => $value) {
            if (is_array($value) && isset ($merged[$key]) && is_array($merged[$key])) {
                $merged[$key] = $this->merge($merged[$key], $value);
            } else {
                $merged[$key] = $value;
            }
        }

        return $merged;
    }
264883
protected function mergeValues(array $values, $merge = true)
    {
        $this->values = $merge ? array_merge($this->values, $values) : $values;
        return $this;
    }
1313583
public function createFromArray(array $types)
    {
        foreach ($types as $type) {
            $this->collection->add(Type::fromString($type));
        }

        return $this->collection;
    }
429459
public static function merge(array $array)
    {
        $result = array();
        foreach ($array as $config) {
            if (is_string($config)) {
                if (!file_exists($config)) {
                    continue;
                }
                $config = require($config);
            }
            if (!is_array($config)) {
                continue;
            }
            $result = self::mergeArray($result, $config);
        }
        return $result;
    }
633231
public function fieldsAs(array $types){
		$i=0;
		if(JArray::isAssociative($types)){
			foreach ($types as $type=>$attributes){
				if(\is_int($type))
					$this->fieldAs($i++,$attributes,[]);
				else{
					$type=preg_replace('/\d/', '', $type );
					$this->fieldAs($i++,$type,$attributes);
				}
			}
		}else{
			foreach ($types as $type){
				$this->fieldAs($i++,$type);
			}
		}
	}
1160783
public function type( $types )
	{
		if( !empty( $types ) ) {
			$this->conditions[] = $this->filter->compare( '==', 'stock.type', $types );
		}

		return $this;
	}
1105111
public function whereTypeIn(array $types)
    {
        if (count($types) > 0) {
            $this->joinSingleRelatives = true;
            $clause = '';

            for ($i = 0, $count = count($types); $i < $count; $i++) {
                $clause .= $i === 0 ?
                    "resourceType.name = :type_{$i}" :
                    "OR resourceType.name = :type_{$i}";
                $clause .= $i < $count - 1 ? PHP_EOL : '';
                $this->parameters[":type_{$i}"] = $types[$i];
            }

            $this->addWhereClause($clause);
        }

        return $this;
    }
562849
public static function isTypesOf(array $array, array $types) : bool
    {
        if (!self::isTypeOf($types, 'string')) {
            return false;
        }

        $types = array_map(function ($type) {
            return DataTypes::guessFromAlias($type);
        }, $types);

        if (array_diff($types, DataTypes::TYPES)) {
            return false;
        }

        foreach ($array as $item) {
            if (!in_array(gettype($item), $types, true)) {
                return false;
            }
        }

        return true;
    }
406449
public function merge($items)
    {
        $dictionary = $this->getDictionary();

        foreach ($items as $item) {
            $dictionary[$item->getKey()] = $item;
        }

        return new static(array_values($dictionary));
    }
218545
public static function array_merge_multi()
    {
        $args = func_get_args();
        $array = [];
        foreach ($args as $arg) {
            if (is_array($arg)) {
                foreach ($arg as $k => $v) {
                    if (is_array($v)) {
                        $array[$k] = isset($array[$k]) ? $array[$k] : [];
                        $array[$k] = static::array_merge_multi($array[$k], $v);
                    } else {
                        $array[$k] = $v;
                    }
                }
            }
        }

        return $array;
    }