These steps can occur in different sessions.

@param string $step

@return $this

@throws ContactClientException
967917
public function run($step = 'add')
    {
        $this->setLogs($step, 'step');
        switch ($step) {
            // Step 1: Validate and add a contact to a queue for the next file for the client.
            case 'add':
                $this->getFieldValues();
                $this->fileEntitySelect(true);
                $this->fileEntityRefreshSettings();
                $this->addContactToQueue();
                break;

            // Step 3: Build the file (if a good time), performing a second validation on each contact.
            case 'build':
                if ($this->test) {
                    $this->getFieldValues();
                }
                $this->fileEntitySelect();
                $this->evaluateSchedule(true);
                $this->fileEntityRefreshSettings();
                $this->fileBuild();
                break;

            // Step 4: Perform file send operations, if any are configured.
            case 'send':
                $this->fileEntitySelect(false, File::STATUS_READY);
                $this->evaluateSchedule(true);
                $this->fileSend();
                break;
        }

        return $this;
    }
579095
protected function create($step)
    {
        $locationService = $this->repository->getLocationService();

        if (!isset($step->dsl['parent_location']) && !isset($step->dsl['parent_location_id'])) {
            throw new \Exception('Missing parent location id. This is required to create the new location.');
        }

        // support legacy tag: parent_location_id
        if (!isset($step->dsl['parent_location']) && isset($step->dsl['parent_location_id'])) {
            $parentLocationIds = $step->dsl['parent_location_id'];
        } else {
            $parentLocationIds = $step->dsl['parent_location'];
        }

        if (!is_array($parentLocationIds)) {
            $parentLocationIds = array($parentLocationIds);
        }

        if (isset($step->dsl['is_main']) && count($parentLocationIds) > 1) {
            throw new \Exception('Can not set more than one new location as main.');
        }

        // resolve references and remote ids
        foreach ($parentLocationIds as $id => $parentLocationId) {
            $parentLocationId = $this->referenceResolver->resolveReference($parentLocationId);
            $parentLocationIds[$id] = $this->matchLocationByKey($parentLocationId)->id;
        }

        $contentCollection = $this->matchContents('create', $step);

        $locations = array();
        foreach ($contentCollection as $content) {
            $contentInfo = $content->contentInfo;

            foreach ($parentLocationIds as $parentLocationId) {
                $locationCreateStruct = $locationService->newLocationCreateStruct($parentLocationId);

                if (isset($step->dsl['is_hidden'])) {
                    $locationCreateStruct->hidden = $this->referenceResolver->resolveReference($step->dsl['is_hidden']);
                }

                if (isset($step->dsl['priority'])) {
                    $locationCreateStruct->priority = $this->referenceResolver->resolveReference($step->dsl['priority']);
                }

                if (isset($step->dsl['sort_order'])) {
                    $locationCreateStruct->sortOrder = $this->getSortOrder($this->referenceResolver->resolveReference($step->dsl['sort_order']));
                }

                if (isset($step->dsl['sort_field'])) {
                    $locationCreateStruct->sortField = $this->getSortField($this->referenceResolver->resolveReference($step->dsl['sort_field']));
                }

                if (isset($step->dsl['remote_id'])) {
                    $locationCreateStruct->remoteId = $this->referenceResolver->resolveReference($step->dsl['remote_id']);
                }

                $location = $locationService->createLocation($contentInfo, $locationCreateStruct);

                if (isset($step->dsl['is_main'])) {
                    $this->setMainLocation($location);
                    // we have to reload the location so that correct data can be set as reference
                    $location = $locationService->loadLocation($location->id);
                }

                $locations[] = $location;
            }
        }

        $locationCollection = new LocationCollection($locations);

        $this->setReferences($locationCollection, $step);

        return $locationCollection;
    }
1284423
public function _beforeStep(Step $step)
    {
        if ($step->getAction() === 'click') {
            $this->debug('Waiting for nprogress to hide...');
            $this->getModule('WebDriver')->waitForElementNotVisible('#nprogress', 10);
        }
    }
947944
protected function delete($step)
    {
        $groupsCollection = $this->matchObjectStateGroups('delete', $step);

        $this->setReferences($groupsCollection, $step);

        $objectStateService = $this->repository->getObjectStateService();

        foreach ($groupsCollection as $objectStateGroup) {
            $objectStateService->deleteObjectStateGroup($objectStateGroup);
        }

        return $groupsCollection;
    }
38195
protected function update($step)
    {
        $userCollection = $this->matchUsers('user', $step);

        if (count($userCollection) > 1 && isset($step->dsl['references'])) {
            throw new \Exception("Can not execute User update because multiple users match, and a references section is specified in the dsl. References can be set when only 1 user matches");
        }

        if (count($userCollection) > 1 && isset($step->dsl['email'])) {
            throw new \Exception("Can not execute User update because multiple users match, and an email section is specified in the dsl.");
        }

        $userService = $this->repository->getUserService();

        foreach ($userCollection as $key => $user) {

            $userUpdateStruct = $userService->newUserUpdateStruct();

            if (isset($step->dsl['email'])) {
                $userUpdateStruct->email = $this->referenceResolver->resolveReference($step->dsl['email']);
            }
            if (isset($step->dsl['password'])) {
                $userUpdateStruct->password = (string)$this->referenceResolver->resolveReference($step->dsl['password']);
            }
            if (isset($step->dsl['enabled'])) {
                $userUpdateStruct->enabled = $this->referenceResolver->resolveReference($step->dsl['enabled']);
            }

            $user = $userService->updateUser($user, $userUpdateStruct);

            if (isset($step->dsl['groups'])) {
                $groups = $step->dsl['groups'];

                if (!is_array($groups)) {
                    $groups = array($groups);
                }

                $assignedGroups = $userService->loadUserGroupsOfUser($user);

                $targetGroupIds = [];
                // Assigning new groups to the user
                foreach ($groups as $groupToAssignId) {
                    $groupId = $this->referenceResolver->resolveReference($groupToAssignId);
                    $groupToAssign = $this->userGroupMatcher->matchOneByKey($groupId);
                    $targetGroupIds[] = $groupToAssign->id;

                    $present = false;
                    foreach ($assignedGroups as $assignedGroup) {
                        // Make sure we assign the user only to groups he isn't already assigned to
                        if ($assignedGroup->id == $groupToAssign->id) {
                            $present = true;
                            break;
                        }
                    }
                    if (!$present) {
                        $userService->assignUserToUserGroup($user, $groupToAssign);
                    }
                }

                // Unassigning groups that are not in the list in the migration
                foreach ($assignedGroups as $assignedGroup) {
                    if (!in_array($assignedGroup->id, $targetGroupIds)) {
                        $userService->unAssignUserFromUserGroup($user, $assignedGroup);
                    }
                }
            }

            $userCollection[$key] = $user;
        }

        $this->setReferences($userCollection, $step);

        return $userCollection;
    }
717680
protected function decrementUseCount($step = 1)
	{
		$this->useCount -= $step;
		foreach ($this->value as $value)
		{
			if ($value instanceof ConfigValue)
			{
				$value->decrementUseCount($step);
			}
		}
	}
1336584
protected function delete($step)
    {
        if (isset($step->dsl['lang'])) {
            // BC
            $step->dsl['match'] = array('language_code' => $step->dsl['lang']);
        }
        $languageCollection = $this->matchLanguages('delete', $step);

        $this->setReferences($languageCollection, $step);

        $languageService = $this->repository->getContentLanguageService();

        foreach ($languageCollection as $language) {
            $languageService->deleteLanguage($language);
        }

        return $languageCollection;
    }
1061253
protected function steplogic($step) {
		if ( ! isset($this->_method_cache[$step])) {
			$dbh = $this->dbh();
			$class = \hlin\PHP::pnn(call_user_func($this->stepclass, $step));
			$this->_method_cache[$step] = $class::instance($dbh);
		}
		return $this->_method_cache[$step];
	}
49717
protected function runStep($step, $pretend = false)
    {
        try
        {
            $step = $this->createStep($step);

            if ($this->confirm($step->prompt(), true))
            {
                return $step->run($pretend);
            }
        }
        catch (\Exception $e)
        {
            $this->error($e->getMessage());
        }

        return false;
    }
979405
public function setStep($v)
    {
        if ($v !== null) {
            $v = (double) $v;
        }

        if ($this->step !== $v) {
            $this->step = $v;
            $this->modifiedColumns[AttributeTypeTableMap::STEP] = true;
        }


        return $this;
    }
1341688
private function getNextStep($sessionId, $message, Context $context)
    {
        $stepData = $this->converseApi->converse($sessionId, $message, $context);

        if (null === $stepData) {
            $stepData = [];
        }

        if (isset($stepData['error'])) {
            throw new ConversationException($stepData['error'], $sessionId, $context, $stepData);
        }

        try {
            $step = StepFactory::create($stepData);
        } catch (InvalidStepException $e) {
            throw new ConversationException($e->getMessage(), $sessionId, $context, $e->getStepData());
        }

        return $step;
    }
156060
protected function create($step)
    {
        $roleService = $this->repository->getRoleService();
        $userService = $this->repository->getUserService();

        $roleName = $this->referenceResolver->resolveReference($step->dsl['name']);
        $roleCreateStruct = $roleService->newRoleCreateStruct($roleName);

        // Publish new role
        $role = $roleService->createRole($roleCreateStruct);
        if (is_callable(array($roleService, 'publishRoleDraft'))) {
            $roleService->publishRoleDraft($role);
        }

        if (isset($step->dsl['policies'])) {
            foreach ($step->dsl['policies'] as $key => $ymlPolicy) {
                $this->addPolicy($role, $roleService, $ymlPolicy);
            }
        }

        if (isset($step->dsl['assign'])) {
            $this->assignRole($role, $roleService, $userService, $step->dsl['assign']);
        }

        $this->setReferences($role, $step);

        return $role;
    }
1109186
protected function reachStep(ModelInterface $model, Step $step, ModelState $currentModelState = null)
    {
        try {
            $this->checkCredentials($model, $step);
        } catch (AccessDeniedException $e) {
            $violations = new ViolationList();
            $violations->add(new Violation($e->getMessage()));

            $modelState = $this->storage->newModelStateError($model, $this->process->getName(), $step->getName(), $violations, $currentModelState);

            $eventName = sprintf('%s.%s.bad_credentials', $this->process->getName(), $step->getName());
            $this->dispatcher->dispatch($eventName, new StepEvent($step, $model, $modelState));

            if ($step->getOnInvalid()) {
                $step = $this->getProcessStep($step->getOnInvalid());
                $modelState = $this->reachStep($model, $step);
            }

            return $modelState;
        }

        $event = new ValidateStepEvent($step, $model, new ViolationList());
        $eventName = sprintf('%s.%s.validate', $this->process->getName(), $step->getName());
        $this->dispatcher->dispatch($eventName, $event);

        if (0 === count($event->getViolationList())) {
            $modelState = $this->storage->newModelStateSuccess($model, $this->process->getName(), $step->getName(), $currentModelState);

            // update model status
            if ($step->hasModelStatus()) {
                list($method, $constant) = $step->getModelStatus();
                $model->$method(constant($constant));
            }

            $eventName = sprintf('%s.%s.reached', $this->process->getName(), $step->getName());
            $this->dispatcher->dispatch($eventName, new StepEvent($step, $model, $modelState));
        } else {
            $modelState = $this->storage->newModelStateError($model, $this->process->getName(), $step->getName(), $event->getViolationList(), $currentModelState);

            $eventName = sprintf('%s.%s.validation_fail', $this->process->getName(), $step->getName());
            $this->dispatcher->dispatch($eventName, new StepEvent($step, $model, $modelState));

            if ($step->getOnInvalid()) {
                $step = $this->getProcessStep($step->getOnInvalid());
                $modelState = $this->reachStep($model, $step);
            }
        }

        return $modelState;
    }
945995
protected function delete($step)
    {
        $userCollection = $this->matchUsers('delete', $step);

        $this->setReferences($userCollection, $step);

        $userService = $this->repository->getUserService();

        foreach ($userCollection as $user) {
            $userService->deleteUser($user);
        }

        return $userCollection;
    }
245128
public function move($steps)
	{
		if(is_array($steps) || $steps instanceof \Countable)
		{
			$this->index += count($steps);
		}
		else
		{
			$this->index += (int)$steps;
		}

		return $this;
	}
1163011
function nextStep( $step )
    {
        foreach ( $this->StepTable as $key => $tableStep )
        {
            if ( $step['class'] == $tableStep['class'] )
            {
                return $this->StepTable[++$key];
            }
        }
        $retValue = null;
        return $retValue;
    }
592970
public function steps($step = 0) {
        $this->hr(1);

        $counter = 1;

        foreach ($this->steps as $title => $method) {
            if ($counter < $step) {
                $this->out('[x] ' . $title);
            } else {
                $this->out(sprintf('[%s] <info>%s</info>', $counter, $title));
            }

            $counter++;
        }

        $this->out();
    }