Merges values together.

@param mixed $leftSide  The left side to merge
@param mixed $rightSide The right side to merge

@return mixed The merged values

@throws InvalidConfigurationException
@throws \RuntimeException
338044
protected function mergeValues($leftSide, $rightSide)
    {
        if (false === $rightSide) {
            // if this is still false after the last config has been merged the
            // finalization pass will take care of removing this key entirely
            return false;
        }

        if (false === $leftSide || !$this->performDeepMerging) {
            return $rightSide;
        }

        foreach ($rightSide as $k => $v) {
            // no conflict
            if (!\array_key_exists($k, $leftSide)) {
                if (!$this->allowNewKeys) {
                    $ex = new InvalidConfigurationException(sprintf('You are not allowed to define new elements for path "%s". Please define all elements for this path in one config file. If you are trying to overwrite an element, make sure you redefine it with the same name.', $this->getPath()));
                    $ex->setPath($this->getPath());

                    throw $ex;
                }

                $leftSide[$k] = $v;
                continue;
            }

            if (!isset($this->children[$k])) {
                throw new \RuntimeException('merge() expects a normalized config array.');
            }

            $leftSide[$k] = $this->children[$k]->merge($leftSide[$k], $v);
        }

        return $leftSide;
    }
812114
public function setLeftnode($leftnode)
    {
        if (false === Numeric::isPositiveInteger($leftnode)) {
            throw new InvalidArgumentException('A nested node position must be a strictly positive integer.');
        }

        $this->_leftnode = $leftnode;

        return $this;
    }
264217
public function merge(ContainerConfigurationInterface $containerNode)
    {
        // iterate over this container server nodes
        /** @var \AppserverIo\Appserver\Core\Api\Node\ServerNodeInterface $serverNode */
        foreach ($this->getServers() as $serverNode) {
            // try to match with the server names of the passed container
            /** @var \AppserverIo\Appserver\Core\Api\Node\ServerNodeInterface $serverNodeToMerge */
            foreach ($containerNode->getServers() as $serverNodeToMerge) {
                if (fnmatch($serverNodeToMerge->getName(), $serverNode->getName())) {
                    $serverNode->merge($serverNodeToMerge);
                } else {
                    $this->attachServer($serverNode);
                }
            }
        }
    }
1148185
public function mergeConfig(array $config, $mode = false)
	{
		if ($mode === true)
		{
			$this->config = \Arr::merge($config, $this->config);
		}
		else
		{
			$this->config = \Arr::merge($this->config, $config);
		}

		return $this;
	}
1080108
protected function CreateConditionGT(Selectable $leftHandSide, Selectable $rightHandSide)
    {
        return Condition::GT($this->connection, $leftHandSide, $rightHandSide);
    }
636869
protected function mergeOutput(array $left, array $right)
	{
		if (empty($left))
		{
			return $right;
		}

		if (empty($right))
		{
			return $left;
		}

		// Test whether we can merge the last expression on the left with the first expression on
		// the right
		$k = count($left) - 1;

		if (substr($left[$k], -1) === "'" && $right[0][0] === "'")
		{
			$right[0] = substr($left[$k], 0, -1) . substr($right[0], 1);
			unset($left[$k]);
		}

		return array_merge($left, $right);
	}
1228203
private static function merge($left, $right): array
    {
        $result = [];
        $i = $j = 0;

        $leftCount = count($left);
        $rightCount = count($right);

        while ($i < $leftCount && $j < $rightCount) {
            if ($left[$i] > $right[$j]) {
                $result[] = $right[$j];
                $j++;
            } else {
                $result[] = $left[$i];
                $i++;
            }
        }
        while ($i < $leftCount) {
            $result[] = $left[$i];
            $i++;
        }
        while ($j < $rightCount) {
            $result[] = $right[$j];
            $j++;
        }

        return $result;
    }
432828
public function leftJoin($table, $leftKey, $rightKey)
	{
		$this->syntax->setJoin($table, $leftKey, $rightKey, 'left');
		return $this;
	}
217900
public function leftJoin($table, $where, $using = true)
    {
        return $this->join('LEFT', $table, $where, $using);
    }
995947
public function mergeOptions(array $options, $recursive = false, $reverse = false)
    {

        $nameSpace = $this->getOptionNameSpace();
        if (!empty($nameSpace)) {

            $o = [];
            Config::set($nameSpace, $options, $o);
            $options = $o;
        }

        $this->getTargetConfigurableObject()
            ->mergeOptions($options, $recursive, $reverse);

        return $this;
    }
383345
public function merge(ServerNodeInterface $serverNode)
    {

        // append the certificate nodes found in the passed server node
        /** @var \AppserverIo\Appserver\Core\Api\Node\CertificateNode $certificate */
        foreach ($serverNode->getCertificates() as $certificate) {
            $this->certificates[] = $certificate;
        }

        // append the virtual host nodes found in the passed server node
        /** @var \AppserverIo\Appserver\Core\Api\Node\VirtualHostNode $virtualHost */
        foreach ($serverNode->getVirtualHosts() as $virtualHost) {
            $this->virtualHosts[] = $virtualHost;
        }

        // append the location nodes found in the passed server node
        /** @var \AppserverIo\Appserver\Core\Api\Node\LocationNode $location */
        foreach ($serverNode->getLocations() as $location) {
            $this->locations[] = $location;
        }

        // append the environment variable nodes found in the passed server node
        /** @var \AppserverIo\Appserver\Core\Api\Node\EnvironmentVariableNode $environmentVariable */
        foreach ($serverNode->getEnvironmentVariables() as $environmentVariable) {
            $this->environmentVariables[] = $environmentVariable;
        }

        // append the rewrite nodes found in the passed server node
        /** @var \AppserverIo\Appserver\Core\Api\Node\RewriteNode $rewrite */
        foreach ($serverNode->getRewrites() as $rewrite) {
            $this->rewrites[] = $rewrite;
        }

        // append the access nodes found in the passed server node
        /** @var \AppserverIo\Appserver\Core\Api\Node\AccessNode $access */
        foreach ($serverNode->getAccesses() as $access) {
            $this->accesses[] = $access;
        }
    }
46576
protected function recursiveReorder($root, $parentId, $left)
    {
        $right = $left + 1;
        $children = array_get($root, 'children', []);
        foreach ($children as $child) {
            $right = $this->recursiveReorder($child, $root['id'], $right);
        }
        $this->move($root['id'], $parentId, $left, $right);
        $left = $right + 1;

        return $left;
    }
133141
public static <K, V> MergeResult<K, V> mergeRightIntoLeft(LinkedOptionalMap<K, V> left, LinkedOptionalMap<K, V> right) {
		LinkedOptionalMap<K, V> merged = new LinkedOptionalMap<>(left);
		merged.putAll(right);

		return new MergeResult<>(merged, isLeftPrefixOfRight(left, right));
	}
44770
function leftJoin($relation, $expr = null)
    {
        return $this->join($relation, $expr, Join::LEFT);
    }
421109
def merge(left, right, how='inner', key=None, left_key=None, right_key=None,
          left_as='left', right_as='right'):
    
    return join(left, right, how, key, left_key, right_key,
                join_fn=make_union_join(left_as, right_as))
149651
public function merge(UnitOfWork $other)
    {
        if (!$this->uniqueId->equals($other->uniqueId)) {
            throw new \InvalidArgumentException(
                'Cannot merge units with different UIDs'
            );
        }

        $this->workload = new Workload(
            sprintf(
                '%s%s',
                $this->getQuery(),
                $other->getQuery()
            )
        );
    }
587315
protected function mul($left, $right, $precision)
    {
        if (is_null($precision)) return $left * $right;
        return floatval(\bcmul($left, $right, $precision));
    }