Switches rank position with another model.
@param integer $to another model current rank position.
963073
public function rankSwitch($to)
    {
        $owner = $this->owner;
        $this->getSiblings()->andWhere([$this->attribute => $to])->one()->updateAttributes([
            $this->attribute => $this->owner->getAttribute($this->attribute)
        ]);
        $owner->updateAttributes([$this->attribute => $to]);
    }
1096952
public function transferRoles(User $from, User $to)
    {
        $roles = $from->getEntityRoles();

        foreach ($roles as $role) {
            $to->addRole($role);
        }

        $this->objectManager->flush();

        return count($roles);
    }
365906
public function move($from, $to)
    {
        $this->clearAll();

        $from = trim($from);
        if (!$this->validatePath($from)) {
            throw new \InvalidArgumentException('Invalid source path');
        }

        $to = trim($to);
        if (!$this->validatePath($to)) {
            throw new \InvalidArgumentException('Invalid destination path');
        }

        $this->addCommandName(self::GIT_MOVE);
        $this->addCommandSubject($from);
        $this->addCommandSubject2($to);

        return $this->getCommand();
    }
842593
public function switchPinState($post)
    {
        $post->setPinned(!$post->isPinned());
        $this->om->persist($post);
        $this->om->flush();
    }
293123
private function swap($a, $b) {
        $value            = $this->values[$a];
        $this->values[$a] = $this->values[$b];
        $this->values[$b] = $value;
    }
403617
function addTo($to) {
		if(!is_array($to)) {
			$this->to[] = $to;
		}
		else {
			$this->to = array_merge($this->to, $to);
		}
	}
1200030
public function moveBefore($model)
    {
        if ( is_numeric($model) ) {
            $model = call_user_func("$this->ownerClassName::findOne", $model);
        }
        $parentId = $this->parentIdField ? $model->{$this->parentIdField} : 0;
        if ( $model->{$this->sortField} < 1 ) {
            $this->reorder($parentId);
            $model->refresh();
        }
        $prevIdx = $this->getMaxIdx($parentId, $model->{$this->sortField});
        if ( $model->{$this->sortField} - $prevIdx < 2 ) {
            $this->reorder($parentId);
            $model->refresh();
            $prevIdx = $this->getMaxIdx($parentId, $model->{$this->sortField});
        }
        $newIdx = $model->{$this->sortField} - floor(($model->{$this->sortField} - $prevIdx)/2);
        if ( $this->parentIdField ) {
            call_user_func("$this->ownerClassName::updateAll", [
                $this->sortField => $newIdx,
                $this->parentIdField => $parentId,
            ], [ $this->primaryKey => $this->owner->primaryKey ]);
        } else {
            call_user_func("$this->ownerClassName::updateAll",
                [ $this->sortField => $newIdx ],
                [ $this->primaryKey => $this->owner->primaryKey ]);
        }
        $this->invalidateTagDependency();
    }
25790
public function turn($toggle)
    {
        if(preg_match_all('/^(on|off) (all)?\s?(debug|info|notice|warn|error|critical|alert|emergency)$/', $toggle, $matches)) {
            $flag = $matches[1][0];
            $all = $matches[2][0];
            $name = $matches[3][0];
            $this->sieve->toggle($flag, $name);
            if($all === 'all') {
                self::$SIEVE->toggle($flag, $name);
            }
        } else {
            throw new \InvalidArgumentException("Invalid format: $toggle");
        }
    }
1040394
public function renameRemoteFile($from, $to)
    {
        if(@ssh2_sftp_rename($this->sftp, $from, $to)){
            throw new \Exception("Could not rename file from $from to $to");
        }

        return true;
    }
141710
public function rename($from, $to)
    {
        if (is_null($key = $this->search($from))) {
            return false;
        }

        $this->items[$key] = $this->getSlugFromName($to);

        return true;
    }
412977
void switchTwoColumns(int columnIndex, int columnToIndex) {
        for (int i = 0; i < getRowCount() - 1; i++) {
            Object cellData = getItems()[i][columnToIndex];
            getItems()[i][columnToIndex] = getItems()[i][columnIndex];
            getItems()[i][columnIndex] = cellData;
        }
    }
921563
public function rename($to) {

		$from		= $this->filename;

		// name is unchanged, nothing to do

		if($from !== $to) {

			$oldpath	= $this->folder->getPath() . $from;
			$newpath	= $this->folder->getPath() . $to;
	
	
			if(file_exists($newpath)) {
				throw new FilesystemFileException("Rename from '$oldpath' to '$newpath' failed. '$newpath' already exists.", FilesystemFileException::FILE_RENAME_FAILED);
			}
	
			if(@rename($oldpath, $newpath)) {

				$this->renameCacheEntries($to);

				// set new filename

				$this->filename = $to;

				// re-read fileinfo
				
				$this->fileInfo	= new \SplFileInfo($newpath);

				self::$instances[$newpath] = $this;
				unset(self::$instances[$oldpath]);
			}
	
			else {
				throw new FilesystemFileException(sprintf("Rename from '%s' to '%s' failed.", $oldpath, $newpath), FilesystemFileException::FILE_RENAME_FAILED);
			}

		}
		
		return $this;

	}
413397
protected function moveUp($id)
    {
        $model = $this->getModel($id);
        $orderAttrName = $this->positionAttribute;
        $orderDir = SORT_DESC;

        $swapModel = $model::find()
            ->where(['<', $orderAttrName, $model->$orderAttrName])
            ->orderBy([$orderAttrName => $orderDir])
            ->one();

        if ($swapModel) {
            $newOrderNumeric = $swapModel->$orderAttrName;
            $swapModel->$orderAttrName = $model->$orderAttrName;
            $model->$orderAttrName = $newOrderNumeric;
            $swapModel->save() && $model->save();
        }

        return $this->redirect($model);
    }
536129
public function moveFilesWildcard($from, $to)
    {
        coollect(glob($this->dataDir($from)))->each(function ($from) use ($to) {
            $this->mkDir($dir = $this->dataDir($to));

            rename($from, $dir.'/'.basename($from));
        });
    }
24236
public function migrateExpiredJobs($from, $to)
    {
        return tap(parent::migrateExpiredJobs($from, $to), function ($jobs) use ($to) {
            $this->event($to, new JobsMigrated($jobs));
        });
    }
1154757
public function move($offset_from, $offset_to)
	{
		if
		(
			   $this->offsetExists($offset_from)
			&& $this->offsetExists($offset_to)
		)
		{
			$this->add($offset_to, $this->remove($offset_from));
		}
		else
		{
			throw new OutOfRangeException('Offset invalid or out of range');
		}
	}
49102
public function move($from, $to)
    {
        $call = 'fileops/move';
        $params = array(
                'root' => $this->root,
                'from_path' => $this->normalisePath($from),
                'to_path' => $this->normalisePath($to),
        );
        $response = $this->fetch('POST', self::API_URL, $call, $params);
        return $response;
    }