@param string $step
@param array  $params

@throws \Http\Client\Exception

@return array
12327
public function stop(string $step, array $params = [])
    {
        $path = $this->buildStepsPath($step, 'stopPipeline');

        return $this->post($path, $params);
    }
884279
private function performStep($sessionId, Step $step)
    {
        switch (true) {
            case $step instanceof Action:
                return $this->actionMapping->action($sessionId, $step->getAction(), $step->getParameters(), $step->getContexts());
                break;
            case $step instanceof Speech:
                return $this->actionMapping->speech($sessionId, $step->getSpeech(), $step->getContexts());
                break;
        }

        return false;
    }
72012
protected function stepExist($step)
    {
        return isset($this->steps[$step]) && class_exists($this->steps[$step]);
    }
1038006
protected function validateStep($step)
    {
        $stepGroups = [
            'information' => ['ekyna_cart_index',        ['Default', 'Cart']],
            'shipment'    => ['ekyna_cart_informations', ['Default', 'Cart', 'Information']],
            'payment'     => ['ekyna_cart_shipment',     ['Default', 'Cart', 'Information', 'Shipment']],
        ];
        if (!array_key_exists($step, $stepGroups)) {
            throw new \InvalidArgumentException(sprintf('Undefined step "%s".', $step));
        }

        $cart = $this->getCart();
        $errorList = $this->get('validator')->validate($cart, $stepGroups[$step][1]);
        if (0 != $errorList->count()) {
            return $this->redirect($this->generateUrl($stepGroups[$step][0]));
        }

        return null;
    }
1364555
function previousStep( $step )
    {
        if ( is_string( $step ) ){
            foreach ( $this->StepTable as $key => $tableStep )
            {
                if ( $step == $tableStep['class'] )
                {
                    return $this->StepTable[--$key];
                }
            }
        }
        else
        {
            foreach ( $this->StepTable as $key => $tableStep )
            {
                if ( $step['class'] == $tableStep['class'] )
                {
                    return $this->StepTable[--$key];
                }
            }
        }
        $retValue = null;
        return $retValue;
    }
6228
public static function handleApplicationPlugins($step)
    {
        foreach (self::$pluginsOrder as $plugins) {
            foreach ($plugins as $pluginClass) {
                self::$plugins[$pluginClass]->$step();
            }
        }
    }
800920
public function call($method, $params = [])
    {
        if (null === $this->client) {
            $this->client = new Client([
                'base_uri' => static::API_URL,
                'content-type' => 'application/json',
            ]);
        }

        $requestParams = array_merge($this->defaultParams, [
            $method => [$params],
        ]);

        if ($this->sandbox) {
            $requestParams['apikey'] = self::SANDBOX_KEY;
        }

        $response = $this->client->post(null, ['body' => json_encode($requestParams)]);
        if ($response->getStatusCode() != 200) {
            throw new \Exception('Api http error: ' . $response->getStatusCode(), $response->getStatusCode());
        }

        $result = json_decode($response->getBody(), true);
        if (isset($result['error'])) {
            throw new \BadMethodCallException('Api error: ' . $result['error']['description'],
                $result['error']['code']);
        }

        return $result;
    }
1055666
private function _get_args_from_params(array $params)
	{
		$byType	=	$this->container->requestRouteParams;
		$args	=	[];
		foreach ($params as $param)
		{
			if ($param->hasType() && isset($byType[$type = strtolower($param->getType())]))
				$args[] = $byType[$type];
			else if (isset($this->params[$param->name]))
				$args[] = $this->params[$param->name];
			else if (isset($_GET[$param->name]))
				$args[] = $_GET[$param->name];
			else if (isset($_POST[$param->name]))
				$args[] = $_POST[$param->name];
			else
			{
				if ( ! $param->isOptional())
					throw new \Exception('Unable to find NON-optional parameter `' . $param->name . ($param->hasType() ? '` of type `' . $param->getType() : null) . '` for route controller/handler: ' . var_export($this->route, true));
				$args[] = $param->getDefaultValue();
			}
		}
		return $args;
	}
480767
private function redirectToNextStep($currentStep, $parameters = array())
    {
        $steps = array_keys($this->steps);
        $nextStep = $steps[1 + array_search($currentStep, $steps)];
        Piwik::redirectToModule('Installation', $nextStep, $parameters);
    }
5748
public function serialize(Step $step, array $options = [])
    {
        $serialized = [
            'id' => $step->getUuid(),
            'parameters' => $this->serializeParameters($step),
            'picking' => $this->serializePicking($step),
            'items' => $this->serializeItems($step, $options),
        ];

        if (!empty($step->getTitle())) {
            $serialized['title'] = $step->getTitle();
        }
        if (!empty($step->getDescription())) {
            $serialized['description'] = $step->getDescription();
        }

        return $serialized;
    }
1337221
public function loadFromArray($params)
    {
        if (!isset($params['requestTimestamp']) || !is_int($params['requestTimestamp'])) {
            throw new ValidationException('The "requestTimestamp" value is missing or invalid.');
        }

        if (!isset($params['signature']) || !is_string($params['signature'])) {
            throw new ValidationException('The "signature" parameter is missing.');
        }

        if (!isset($params['queryParameters']) || !is_array($params['queryParameters'])) {
            throw new ValidationException('The "queryParameters" parameter is missing or invalid.');
        }

        if (!isset($params['body']) || !is_string($params['body'])) {
            throw new ValidationException('The "body" parameter is missing.');
        }

        return parent::loadFromArray($params);
    }
51882
private function serializeStep(Step $step)
    {
        $poster = null;
        if (!empty($step->getPoster())) {
            /** @var PublicFile $file */
            $file = $this->om
                ->getRepository('Claroline\CoreBundle\Entity\File\PublicFile')
                ->findOneBy(['url' => $step->getPoster()]);

            if ($file) {
                $poster = $this->fileSerializer->serialize($file);
            }
        }

        return [
            'id' => $step->getUuid(),
            'title' => $step->getTitle(),
            'description' => $step->getDescription(),
            'poster' => $poster,
            'primaryResource' => $step->getResource() ? $this->resourceNodeSerializer->serialize($step->getResource()) : null,
            'showResourceHeader' => $step->getShowResourceHeader(),
            'secondaryResources' => array_map(function (SecondaryResource $secondaryResource) {
                return $this->resourceNodeSerializer->serialize($secondaryResource->getResource(), [Options::SERIALIZE_MINIMAL]);
            }, $step->getSecondaryResources()->toArray()),
            'display' => [
                'numbering' => $step->getNumbering(),
                'height' => $step->getActivityHeight(),
            ],
            'children' => array_map(function (Step $child) {
                return $this->serializeStep($child);
            }, $step->getChildren()->toArray()),
            'userProgression' => $this->serializeUserProgression($step),
        ];
    }
1371344
public function create(array $params = array())
    {
        $defaults = array(
            'name'      => null,
            'devurl'    => null,
            'is_active' => true,
            'is_public' => false,
        );

        $params = array_filter(
            array_merge($defaults, $params),
            array($this, 'isNotNull')
        );

        if(
            !isset($params['name'])
         || !isset($params['devurl'])
        ) {
            throw new \Exception('Missing mandatory parameters');
        }
        $data = array('project'=>$params);

        return $this->post('/projects.json', $data);
    }
692574
private function _validateParameters ($params)
    {
        if (! isset($params[1])) {
            throw new \Exception('新しく生成するコマンド名を指定してください');
        }

        $command_dir = LIB.'/'.APP.'/Commands';
        if (! is_dir($command_dir)) {
            mkdir($command_dir);
        }

        // 既に同じ名前のコマンドがないかを確認する
        $this->command_name = ucfirst($params[1]);
        foreach (array($command_dir, dirname(__FILE__)) as $read_path) {
            if (file_exists($read_path.'/'.$this->command_name.'.php')) {
                throw new \Exception('既に同じ名前のコマンドが存在しています');
            }
        }
    }
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;
    }
866569
public function skip(int $step): ArrayCollection
    {
        $items = [];
        $pos = 0;

        foreach ($this->items as $key => $value) {
            if ($pos % $step === 0) {
                $items[$key] = $value;
            }
            $pos++;
        }

        return new static($items);
    }
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;
    }