Merge Customers
@param  array               $from
@param  array               $into
@param  ClientInterface|null $client
@return bool
177320
public static function merge($from, $into, ClientInterface $client = null)
    {
        (new static([], $client))
            ->getClient()
            ->setResourcekey(static::class)
            ->send('/v1/customers/merges', 'POST', [
                'from' => $from,
                'into' => $into
            ]);
        return true;
    }
1271050
public function replaceUser(User $from, User $to)
    {
        $portfolioGuides = $this->entityManager->getRepository('IcapPortfolioBundle:PortfolioGuide')->findByUser($from);

        if (count($portfolioGuides) > 0) {
            foreach ($portfolioGuides as $portfolioGuide) {
                $portfolioGuide->setUser($to);
            }

            $this->entityManager->flush();
        }

        return count($portfolioGuides);
    }
738025
public static function mergeTranslations(Translations $from, Translations $to, $options = self::DEFAULTS)
    {
        if ($options & self::REMOVE) {
            $filtered = [];

            foreach ($to as $entry) {
                if ($from->find($entry)) {
                    $filtered[$entry->getId()] = $entry;
                }
            }

            $to->exchangeArray($filtered);
        }

        foreach ($from as $entry) {
            if (($existing = $to->find($entry))) {
                $existing->mergeWith($entry, $options);
            } elseif ($options & self::ADD) {
                $to[] = $entry->getClone();
            }
        }
    }
1177114
public function copyTableData( $from, $to, $columns )
    {
        // get existing rows
        $cols = implode( ', ', array_keys( $columns ) );
        $cols = rtrim( $cols, ',' );

        // move all data to new table
        $rows = $this->query( "SELECT $cols FROM $to" );

        foreach ( $rows as $row )
        {
            $query = "INSERT INTO $from ( $cols ) VALUES ( " .
                rtrim( str_repeat( '?,', count( $columns ), ',' ) ) .
                " )";

            $values = [ ];

            foreach ( $row as $key => $value )
            {
                if ( in_array( $key, array_keys( $columns ) ) )
                {
                    $values[ ] = $row[ $key ];
                }
            }

            $this->execute( $query, $values );
        }
    }
1144101
public function replaceUser(User $from, User $to)
    {
        $items = $this->repository->findBy(['creator' => $from]);

        if (count($items) > 0) {
            foreach ($items as $item) {
                $item->setCreator($to);
            }

            $this->om->flush();
        }

        return count($items);
    }
763099
public function copy(string $from, string $to, array $config = []): bool
    {
        list($prefixFrom, $from) = $this->getPrefixAndPath($from);

        if (($buffer = $this->getFileSystem($prefixFrom)->readStream($from)) === false) {
            return false;
        }

        unset($prefixFrom, $from);

        list($prefixTo, $to) = $this->getPrefixAndPath($to);

        if ($this->getFileSystem($prefixTo)->writeStream($to, $buffer, $config)) {
            unset($prefixTo, $to, $buffer);
            return true;
        }

        return false;
    }
1003288
public function createService($name, ArrayObject $config = NULL, $merge_into_config = FALSE) {
        if($merge_into_config) {
            $service_config = $this->config->offsetExists($name) ? $this->config->offsetGet($name) : new ArrayObject;

            if(is_array($service_config)) {
                $service_config = ArrayObject::fromArray($service_config);
            }

            if($config) {
                $service_config->merge($config);
            }
        }
        else {
            $service_config = $config ?: new ArrayObject;
        }

        if(!$this->hasService($name)) {
            throw new Exception("Service '$name' does not exist.");
        }

        $service = $this->services[$name];

        if(array_key_exists("classname", $service)) {
            $reflection = new ReflectionClass($service["classname"]);

            $params = new ArrayObject($service["params"]);
            $params->merge($service_config);

            if($reflection->implementsInterface("Loops\ServiceInterface")) {
                return call_user_func_array([$service["classname"], "getService" ], [ $params, $this ]);
            }
            else {
                $params->offsetSet("loops", $this);
                return Misc::reflectionInstance($service["classname"], $params);
            }
        }

        if(array_key_exists("callback", $service)) {
            $params = new ArrayObject($service["params"]);
            $params->merge($service_config);
            return call_user_func_array($service["callback"], $params->toArray());
        }

        if(array_key_exists("object", $service)) {
            return $service["object"];
        }
    }
166628
public function ipInRange($ip, $from, $to)
    {
        $ip = $this->getIpNumberFromAddress($ip);
        $from = $this->getIpNumberFromAddress($from);
        $to = $this->getIpNumberFromAddress($to);

        return (!$ip || !$from || !$to) ? false : ($ip <= $to && $from <= $ip);
    }
467738
public final static function merge(string $source, array $Values){
		return self::encode(array_merge(self::decode($source), $Values));
	}
1037417
public function listFor(Customer $customer, $from = null, $limit = null, array $parameters = [])
    {
        return $this->listForId($customer->id, $from, $limit, $parameters);
    }
801660
public function move($messages, $from, $to)
    {
        if (!$this->select($from)) {
            return false;
        }

        if (!$this->data['READ-WRITE']) {
            $this->setError(self::ERROR_READONLY, "Mailbox is read-only");
            return false;
        }

        // use MOVE command (RFC 6851)
        if ($this->hasCapability('MOVE')) {
            // Clear last COPYUID data
            unset($this->data['COPYUID']);

            // Clear internal status cache
            unset($this->data['STATUS:'.$to]);
            $this->clear_status_cache($from);

            $result = $this->execute('UID MOVE', array(
                $this->compressMessageSet($messages), $this->escape($to)),
                self::COMMAND_NORESPONSE);

            return $result == self::ERROR_OK;
        }

        // use COPY + STORE +FLAGS.SILENT \Deleted + EXPUNGE
        $result = $this->copy($messages, $from, $to);

        if ($result) {
            // Clear internal status cache
            unset($this->data['STATUS:'.$from]);

            $result = $this->flag($from, $messages, 'DELETED');

            if ($messages == '*') {
                // CLOSE+SELECT should be faster than EXPUNGE
                $this->close();
            }
            else {
                $this->expunge($from, $messages);
            }
        }

        return $result;
    }
965697
public function hardTranslationSetMerge(Locale $locale, $from, $into)
    {
        foreach ($from as $translation) {
            $translationString = $translation->getTranslation();
            $original = $translation->getOriginal();
            $context = $translation->getContext();
            $merged = $this->addOrCreateString($into, $context, $original);
            $merged->setTranslation($translationString);

            // The following raises an array to string warning
            // $merged->setPluralTranslation($translation->getPluralTranslation());
        }
    }
721935
public static function move($from, $to)
    {
        return self::copy($from, $to) && self::delete($from);
    }
588858
public function merge( $from, $to, EditInfo $editInfo = null ) {
		$params = array(
			'fromid' => $this->getIdFromInput( $from ),
			'toid' => $this->getIdFromInput( $to )
		);

		$this->api->postRequest( 'wbmergeitems', $params, $editInfo );
		return true;
	}
50262
static public function importAttributes(DOMElement $from, DOMElement $into)
    {
        for ($i = 0; $i < $from->attributes->length; $i++) {
            $attr = $from->attributes->item($i);

            if ($attr->localName !== 'schemaLocation') {

                if (empty($attr->namespaceURI) === false) {
                    $into->setAttributeNS($attr->namespaceURI, $attr->prefix . ':' . $attr->localName, $attr->value);
                } else {
                    $into->setAttribute($attr->localName, $attr->value);
                }
            }
        }
    }
605997
public function copyFolder( $from, $to )
	{
		$this->connection->checkConnection();
		$this->createFolder( $to );
		$reader	= new Net_FTP_Reader( $this->connection );
		$list	= $reader->getList( $from, TRUE );
		foreach( $list as $entry )
		{
			if( $entry['isdir'] )
				$this->createFolder( $to."/".$entry['name'] );
			else
				$this->copyFile( $from."/".$entry['name'], $to."/".$entry['name'] );
		}
		return TRUE;
	}
1217344
public function delete($from)
    {
        $query = new Query\DeleteQuery();

        if ($this->pdo) {
            $query->setPDO($this->pdo);
        }

        return $query->from($from);
    }