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
435727
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) {
            // prototype, and key is irrelevant, so simply append the element
            if (null === $this->keyAttribute) {
                $leftSide[] = $v;
                continue;
            }

            // 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.',
                        $this->getPath()
                    ));
                    $ex->setPath($this->getPath());

                    throw $ex;
                }

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

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

        return $leftSide;
    }
1314097
public function setSide($side) {

        $this->checkInArray($side, GDAXConstants::$orderSideValues);
        $this->side = $side;
        return $this;

    }
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()
            )
        );
    }
144791
protected function mergePolicyConfiguration(array $firstConfigurationArray, array $secondConfigurationArray): array
    {
        $result = Arrays::arrayMergeRecursiveOverrule($firstConfigurationArray, $secondConfigurationArray);
        if (!isset($result['roles'])) {
            return $result;
        }
        foreach ($result['roles'] as $roleIdentifier => $roleConfiguration) {
            if (!isset($firstConfigurationArray['roles'][$roleIdentifier]['privileges']) || !isset($secondConfigurationArray['roles'][$roleIdentifier]['privileges'])) {
                continue;
            }
            $result['roles'][$roleIdentifier]['privileges'] = array_merge($firstConfigurationArray['roles'][$roleIdentifier]['privileges'], $secondConfigurationArray['roles'][$roleIdentifier]['privileges']);
        }
        return $result;
    }
1064576
public function onLogicalExpression($expressionType, $left, $right) {
        switch ($expressionType) {
            case ExpressionType::AND_LOGICAL:
//				return '$logicalAnd('.$left.', '.$right.')';
                return $this->_prepareBinaryExpression(self::LOGICAL_AND, $left, $right);
                break;
            case ExpressionType::OR_LOGICAL:
//				return '$logicalOr('.$left.', '.$right.')';
                return $this->_prepareBinaryExpression(self::LOGICAL_OR, $left, $right);
                break;
            default:
                throw new \InvalidArgumentException('onLogicalExpression');
        }
    }
470171
public static function left(string $fromAlias, string $to, string $toAlias, string $condition): Join
    {
        return new self(self::MODE_LEFT, $fromAlias, $to, $toAlias, $condition);
    }
1085046
protected <E> List<E> merge(final List<E> leftElements, final List<E> rightElements) {
    int leftIndex = 0;
    int leftSize = leftElements.size();
    int rightIndex = 0;
    int rightSize = rightElements.size();

    List<E> mergedElements = new ArrayList<>(leftSize + rightSize);

    for (int mergeIndex = 0, mergeSize = (leftSize + rightSize); mergeIndex < mergeSize; mergeIndex++) {
      if (leftIndex == leftSize) {
        mergedElements.add(rightElements.get(rightIndex++));
      }
      else if (rightIndex == rightSize) {
        mergedElements.add(leftElements.get(leftIndex++));
      }
      else {
        E leftElement = leftElements.get(leftIndex);
        E rightElement = rightElements.get(rightIndex);

        if (getOrderBy().compare(leftElement, rightElement) <= 0) {
          mergedElements.add(leftElement);
          leftIndex++;
        }
        else {
          mergedElements.add(rightElement);
          rightIndex++;
        }
      }
    }

    return mergedElements;
  }
680714
protected function CreateConditionIn(Selectable $leftHandSide, InList $inList)
    {
        return Condition::In($this->connection, $leftHandSide, $inList);
    }
941160
public function innerJoin($table, $leftKey, $rightKey)
	{
		$this->syntax->setJoin($table, $leftKey, $rightKey, 'inner');
		return $this;
	}
357355
protected function CreateConditionEqualsNot(Selectable $leftHandSide, Selectable $rightHandSide)
    {
        return Condition::EqualsNot($this->connection, $leftHandSide, $rightHandSide);
    }
173358
public static function xorStrings(string $left, string $right): string
    {
        $length = Binary::safeStrlen($left);
        if ($length !== Binary::safeStrlen($right)) {
            throw new InvalidType(
                'Both strings must be the same length'
            );
        }
        if ($length < 1) {
            return '';
        }
        return (string) ($left ^ $right);
    }
911004
public function leftJoin(
        $joinTableName,
        $key,
        $comparator,
        $value = null,
        $shouldCompareFields = true,
        $tableName = null
    ) {
        return $this->join(
            self::JOIN_LEFT,
            $joinTableName,
            $key,
            $comparator,
            $value,
            $shouldCompareFields,
            $tableName
        );
    }
525299
def merge(left, right):
    
    merged = {}

    left_keys = frozenset(left)
    right_keys = frozenset(right)

    # Items only in the left Mapping
    for key in left_keys - right_keys:
        merged[key] = left[key]

    # Items only in the right Mapping
    for key in right_keys - left_keys:
        merged[key] = right[key]

    # in both
    for key in left_keys & right_keys:
        left_value = left[key]
        right_value = right[key]

        if (isinstance(left_value, Mapping) and
                isinstance(right_value, Mapping)):  # recursive merge
            merged[key] = merge(left_value, right_value)
        else:  # overwrite with right value
            merged[key] = right_value

    return merged
72583
public function removeNodes($left, $right, $root=null)
    {
        $hasManyRoots = $this->getConfiguration()->hasManyRoots();

        $removed = array();
        foreach($this->wrappers as $oid => $wrapper)
        {
            if(!$hasManyRoots || ($wrapper->getRootValue() == $root))
            {
                if($wrapper->getLeftValue() >= $left && $wrapper->getRightValue() <= $right)
                {
                    $removed[$oid] = $wrapper;
                }
            }
        }

        foreach($removed as $key => $wrapper)
        {
            unset($this->wrappers[$key]);
            $wrapper->setLeftValue(0);
            $wrapper->setRightValue(0);
            if($hasManyRoots)
            {
                $wrapper->setRootValue(0);
            }
            $this->getEntityManager()->detach($wrapper->getNode());
        }
    }
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);
                }
            }
        }
    }
297335
public function andLeftnodeEquals($leftnode, $alias = null)
    {
        list($alias, $suffix) = $this->getAliasAndSuffix($alias);

        return $this->andWhere($alias.'._leftnode = :leftnode'.$suffix)
                        ->setParameter('leftnode'.$suffix, $leftnode);
    }
1158581
public function spatialPartition(array $leftCentroid, array $rightCentroid, Distance $kernel)
    {
        if (count($leftCentroid) !== count($rightCentroid)) {
            throw new InvalidArgumentException('Dimensionality mismatch between'
                . ' left and right centroids.');
        }

        $left = $right = [];

        foreach ($this->samples as $i => $sample) {
            $lHat = $kernel->compute($sample, $leftCentroid);
            $rHat = $kernel->compute($sample, $rightCentroid);

            if ($lHat < $rHat) {
                $left[] = $sample;
            } else {
                $right[] = $sample;
            }
        }

        return [
            self::quick($left),
            self::quick($right),
        ];
    }