SuperAdmin can use pass a subject from $fromStatus to $toStatus if such a transition exists

@param StatusInterface $fromStatus
@param StatusInterface StatusInterface $toStatus

@return boolean
972107
protected function voteForSuperAdmin(StatusInterface $fromStatus, StatusInterface $toStatus) {
        return $this->workflowRepository->hasTransition($fromStatus, $toStatus);
    }
1201894
public function replaceSubjectUser(User $from, User $to)
    {
        $subjects = $this->subjectRepo->findByCreator($from);
        if (count($subjects) > 0) {
            foreach ($subjects as $subject) {
                $subject->setCreator($to);
            }
            $this->om->flush();
        }

        return count($subjects);
    }
179185
public function redirect($from, $to, $status = 302)
    {
        $handler = function ($request, ResponseInterface $response) use ($to, $status) {
            return $response->withHeader('Location', (string)$to)->withStatus($status);
        };

        return $this->get($from, $handler);
    }
791813
public function compare($fromTables, $toTables, array $protectedTableNames, $force = false)
    {
        if ($this->response !== null && $force === false) {
            return $this->getResponse();
        }
        if ($force === false) {
            $this->setIgnoredChanges();
        }

        $this->checkTables($fromTables, $toTables);

        // If we have diffs, check if they need to be modified
        if ($this->diffs !== null) {
            $this->adjustDiffs($protectedTableNames);
            $this->addAlterResponses();
        }

        return $this->getResponse();
    }
980839
public function replaceUser(User $from, User $to)
    {
        $contributions = $this->contributionRepository->findByContributor($from);

        if (count($contributions) > 0) {
            foreach ($contributions as $contribution) {
                $contribution->setContributor($to);
            }

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

        return count($contributions);
    }
1311539
public function transferPoints($from, $to, $amount, $leaderTypeFrom = null, $leaderTypeTo = null)
    {   
        $availablePoints = $this->getTotal($from);
        $leaderboardTypeFrom = $this->getLeaderboardTypeService()->getLeaderboardTypeDefault();
        $leaderboardTypeTo = $this->getLeaderboardTypeService()->getLeaderboardTypeDefault();

        if (!empty($leaderTypeFrom)) {
            $leaderboardTypeFrom = $this->getLeaderboardTypeService()->getLeaderboardTypeMapper()->findOneBy(array('name' => $leaderTypeFrom));
        }
        if (!empty($leaderTypeTo)) {
            $leaderboardTypeTo = $this->getLeaderboardTypeService()->getLeaderboardTypeMapper()->findOneBy(array('name' => $leaderTypeTo));
        }

        if ($availablePoints >= $amount) {
            $this->add(-$amount, $from, $leaderboardTypeFrom);
            $this->add($amount, $to, $leaderboardTypeTo);

            return true;
        }

        return false;
    }
1149267
public function send( $to, $subject, $body )
	{
		// Debug advice:
		if ( \Sifo\Domains::getInstance()->getDebugMode() )
		{
			$this->_dispatchMailController( $to, $subject, $body );
		}
		return parent::send( $to, $subject, $body );
	}
749039
private function transition(TransitionalStateInterface $fromState, EventInterface $event)
    {
        if ($fromState instanceof StateActionInterface) {
            $exitEvent = $fromState->getExitEvent();
            if ($exitEvent !== null) {
                if ($this->eventDispatcher !== null) {
                    $this->eventDispatcher->dispatch(StateMachineEvents::EVENT_EXIT, new StateMachineEvent($this, $fromState, $exitEvent));
                }

                $this->runAction($exitEvent);
            }
        }

        $transition = $this->getTransition($fromState, $event);
        $transition->setToken($fromState->getToken());
        $this->previousState = $fromState;
        $this->currentState = null;
        if ($this->eventDispatcher !== null) {
            $this->eventDispatcher->dispatch(StateMachineEvents::EVENT_TRANSITION, new StateMachineEvent($this, null, $event, $transition));
        }
        $this->runAction($event, $transition);
        $transition->getToState()->setToken($transition->getToken());
        $toState = $this->stateCollection->getCurrentState();
        $this->currentState = $toState;
        $this->transitionLog[] = $this->createTransitionLogEntry($transition);

        if ($toState instanceof StateActionInterface) {
            $entryEvent = $toState->getEntryEvent();
            if ($entryEvent !== null) {
                if ($this->eventDispatcher !== null) {
                    $this->eventDispatcher->dispatch(StateMachineEvents::EVENT_ENTRY, new StateMachineEvent($this, $toState, $entryEvent));
                }

                $this->runAction($entryEvent);
            }
        }
    }
492136
public function setOrderStatus($orderId, $status, $subStatus = null)
    {
        $resource = 'campaigns/' . $this->campaignId . '/orders/' . $orderId . '/status.json';

        $data = [
            "order" => [
                "status" => $status
            ]
        ];
        if ($subStatus) {
            $data['order']['substatus'] = $subStatus;
        }

        $response = $this->sendRequest(
            'PUT',
            $this->getServiceUrl($resource),
            [
                'json' => $data
            ]
        );

        $decodedResponseBody = $this->getDecodedBody($response->getBody());

        $updateOrderStatusResponse = new UpdateOrderStatusResponse($decodedResponseBody);
        return $updateOrderStatusResponse->getOrder();
    }
179228
public function addTransition($from, $to)
    {
        if (!isset($this->transitions[$from])) {
            $this->transitions[$from] = array();
        }
        $this->transitions[$from][] = $to;
    }
145856
public function canTransition($subject, $transitionName, $name = null)
    {
        return $this->workflowRegistry->get($subject, $name)->can($subject, $transitionName);
    }
403553
public function replaceUser(User $from, User $to)
    {
        $sections = $this->sectionRepository->findByAuthor($from);

        if (count($sections) > 0) {
            foreach ($sections as $section) {
                $section->setAuthor($to);
            }

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

        return count($sections);
    }
24236
public function migrateExpiredJobs($from, $to)
    {
        return tap(parent::migrateExpiredJobs($from, $to), function ($jobs) use ($to) {
            $this->event($to, new JobsMigrated($jobs));
        });
    }
590030
public function updateStatus(OpportunityStatus $opportunityStatus): OpportunityStatus
    {
        @trigger_error(sprintf('The %s() method is deprecated since version 0.8. Use update() instead.', __METHOD__), E_USER_DEPRECATED);

        return $this->update($opportunityStatus);
    }
1014812
public function onMessage(ConnectionInterface $from, $msg) {
    $data = json_decode($msg, true);
    if (!$data['action']
        || !in_array(
            $data['action'],
            ['authenticate', 'subscribe', 'unsubscribe', 'publish']
        )) {
      return;
    }
    switch ($data['action']) {
      case 'authenticate':
        $this->handleAuthentication($from, $data);
        break;
      case 'subscribe':
      case 'unsubscribe':
        $this->handleSubscription($from, $data);
        break;
      case 'publish':
        $this->handlePublish($from, $msg, $data);
        break;
    }
  }
554439
private void setState(final EvaluatorState toState) {
    while (true) {

      final EvaluatorState fromState = this.state.get();
      if (fromState == toState) {
        break;
      }

      if (!fromState.isLegalTransition(toState)) {
        LOG.log(Level.WARNING, "Illegal state transition: {0} -> {1}", new Object[] {fromState, toState});
        throw new IllegalStateException("Illegal state transition: " + fromState + " -> " + toState);
      }

      if (this.state.compareAndSet(fromState, toState)) {
        break;
      }
    }
  }
313231
public function setStatus(\Sulu\Bundle\Sales\ShippingBundle\Entity\ShippingStatus $status)
    {
        $this->status = $status;
    
        return $this;
    }