Merge the as group into the action.

@param  array $action
@param  string $as
@return array
166919
protected function mergeAsGroup(array $action, $as = null)
    {
        if (isset($as) && ! empty($as)) {
            if (isset($action['as'])) {
                $action['as'] = $as.'.'.$action['as'];
            } else {
                $action['as'] = $as;
            }
        }

        return $action;
    }
1175533
public function onDuplicate($action = null)
	{
		// Save the old action so it can be returned
		$old = $this->onDuplicateAction;

		if (func_num_args() && $action !== 'error' && $action !== 'ignore' && $action !== 'replace')
		{
			throw new InvalidArgumentException("Invalid onDuplicate action '" . $action . "'. Expected: 'error', 'ignore' or 'replace'");
		}

		$this->onDuplicateAction = $action;

		return $old;
	}
1145624
public function mergeAction($action, $identities)
	{
		if (isset($this->data[$action]))
		{
			// If exists, merge the action.
			$this->data[$action]->mergeIdentities($identities);
		}
		else
		{
			// If new, add the action.
			$this->data[$action] = new Rule($identities);
		}
	}
404091
public function setObjectActions(array $actions)
    {
        $this->parsedObjectActions = false;

        $actions = $this->mergeActions($this->defaultObjectActions(), $actions);

        /** Enable seamless button group */
        if (isset($actions['edit'])) {
            $actions['edit']['actionType'] = 'seamless';
        }

        $this->objectActions = $actions;

        return $this;
    }
914492
protected function getActionInformation(Action $action) {
        return [
            $action->getPattern(),
            $action->getName(),
            $action->getMethod(),
            $action->group->getName() . ', ' . $action->group->getPattern(),
            Formatter::shortArray($action->getMiddleware()),
            $action->getUses(),
            Formatter::boolean($action->register),
            Formatter::boolean($action->useSmoothState)
        ];
    }
276655
protected function parseAsListActions(array $actions)
    {
        $listActions = [];
        foreach ($actions as $ident => $action) {
            $ident  = $this->parseActionIdent($ident, $action);
            $action = $this->parseActionItem($action, $ident, true);

            if (!isset($action['priority'])) {
                $action['priority'] = $this->actionsPriority++;
            }

            if ($action['ident'] === 'create') {
                $action['empty'] = true;

                if (!$this->isObjCreatable()) {
                    $action['active'] = false;
                }
            } else {
                $action['empty'] = (isset($action['empty']) ? boolval($action['empty']) : false);
            }

            if (is_array($action['actions'])) {
                $action['actions']    = $this->parseAsListActions($action['actions']);
                $action['hasActions'] = !!array_filter($action['actions'], function ($action) {
                    return $action['active'];
                });
            }

            if (isset($listActions[$ident])) {
                $hasPriority = ($action['priority'] > $listActions[$ident]['priority']);
                if ($hasPriority || $action['isSubmittable']) {
                    $listActions[$ident] = array_replace($listActions[$ident], $action);
                } else {
                    $listActions[$ident] = array_replace($action, $listActions[$ident]);
                }
            } else {
                $listActions[$ident] = $action;
            }
        }

        usort($listActions, [ $this, 'sortActionsByPriority' ]);

        while (($first = reset($listActions)) && $first['isSeparator']) {
            array_shift($listActions);
        }

        while (($last = end($listActions)) && $last['isSeparator']) {
            array_pop($listActions);
        }

        return $listActions;
    }
1294043
public function action(Action $action) {
        if($action->register === Action::REGISTER_AT_END) {
            $this->registerActionsLast[] = $action;
        } else {
            if($action->register) {
                $this->registerAction($action);
            }
        }
    }
1163474
public static function merge($array1, $array2)
	{
		$result = [];
		for ($i = 0; $i < func_num_args(); $i++) {
			$result = parent::merge($result, static::asArray(func_get_arg($i)));
		}

		return $result;
	}
491559
protected function action($action)
    {
        $action = in_array($action, $this->actions) ? $action : null;
        $action = array_key_exists($action, $this->aliases) ? $this->aliases[$action] : $action;

        return $action;
    }
1127258
public static function merge($arrays)
    {
        $merged = [];

        foreach ($arrays as $array)
        {
            $merged = array_merge($merged, static::flatten($array));
        }

        return static::expand($merged);
    }
381626
private function niceMerge(array &$source, array &$destination): array
    {
        $merged = $source;

        foreach ($destination as $key => &$value) {
            if (
                    $this->mergeRecursive &&
                    isset($merged[$key]) &&
                    is_array($merged[$key])
            ) {
                $merged[$key] = $this->niceMerge($source[$key], $value);
                continue;
            }

            $merged[$key] = $value;
        }

        return $merged;
    }
212190
protected function isActive($action)
    {
        $id = $this->getActionId($action);
        return !in_array($id, $this->except, true) && (empty($this->only) || in_array($id, $this->only, true));
    }
1287407
private function my_merge($a, $b){
        if (is_array($b)) {
            foreach ($b as $k => $v) {
                if (isset($a[$k])) {
                    $a[$k] = $this->my_merge($a[$k], $v);
                }else{
                    $a[$k] = $v;
                }
            }
        }
        @asort($a);
        return $a;
    }
495066
protected function mergeActions(array ...$params)
    {
        $unique = [];
        foreach ($params as $actions) {
            foreach ($actions as $ident => $action) {
                if ($action === '|') {
                    $unique[$ident] = $action;
                    continue;
                }

                $ident = $this->parseActionIdent($ident, $action);
                $action['ident'] = $ident;

                $hasActions = (isset($action['actions']) && is_array($action['actions']));
                if ($hasActions) {
                    $action['actions'] = $this->mergeActions($action['actions']);
                } else {
                    $action['actions'] = [];
                }

                if (isset($unique[$ident])) {
                    if (static::compareActions($action, $unique[$ident])) {
                        if ($hasActions && !!$unique[$ident]['actions']) {
                            $action['actions'] = $this->mergeActions(
                                $unique[$ident]['actions'],
                                $action['actions']
                            );
                            unset($unique[$ident]['actions']);
                        }
                        $unique[$ident] = array_replace($unique[$ident], $action);
                    } else {
                        if ($hasActions && !!$unique[$ident]['actions']) {
                            $unique[$ident]['actions'] = $this->mergeActions(
                                $unique[$ident]['actions'],
                                $action['actions']
                            );
                            unset($action['actions']);
                        }
                        $unique[$ident] = array_replace($action, $unique[$ident]);
                    }
                } else {
                    $unique[$ident] = $action;
                }
            }
        }

        return $unique;
    }
905919
protected static function arrayMerge($a, $b)
    {
        foreach ($b as $k => $v) {
            if (!is_array($v) || isset($a[$k]) && !is_array($a[$k])) {
                $a[$k] = $v;
            } else {
                $a[$k] = self::arrayMerge(isset($a[$k])? $a[$k]: array(), $v);
            }
        }
        return $a;
    }
905170
protected function addGroupNamespaceToStringUses($action)
    {
        $groupStack = last($this->router->getGroupStack());

        if (isset($groupStack['namespace']) && strpos($action, '\\') !== 0) {
            return $groupStack['namespace'].'\\'.$action;
        }

        return $action;
    }
1239345
protected function getAliasesForAction($action)
    {
        $actions = [];

        foreach ($this->manager->getAliases() as $aliasName => $alias) {
            if ($alias->hasAction($action)) {
                $actions[] = $aliasName;
            }
        }

        return $actions;
    }