httpClient = $httpClient; $this->requestStack = $requestStack; $this->module = $module; $this->params = $params; } /** * @param int $user_id [user_id ] * * @return [type] [return description] */ /* public function listByUserId(int $user_id) { return $this->httpClient->data('POST', $this->params->get('domain_story') . '/user/' . $user_id . '/story.json', [ 'headers' => [ 'x-auth-token' => $this->requestStack->getCurrentRequest()->headers->get('x-auth-token'), ], 'json' => [ 'module' => $this->module->getModule(), ], ]); } */ /** * @param int $user_id [user_id] * * @return array [array] */ public function lastActionByUserId(int $user_id): array { if ($this->params->get('story_enabled')) { $result = $this->httpClient->data('POST', $this->params->get('domain_story') . '/story/element/last_action.json', [ 'headers' => [ 'x-auth-token' => $this->requestStack->getCurrentRequest()->headers->get('x-auth-token'), ], 'json' => [ 'userId' => $user_id, ], ]); if ($result) { return $result['idObjects']; } } return []; } /** * @param int $elementId [elementId] * * @return array [array] */ public function lastStepAction(int $pageId): array { if ($this->params->get('story_enabled')) { $result = $this->httpClient->data('GET', $this->params->get('domain_story') . '/story/scenario/project/Step/' . $pageId . '.json', [ 'headers' => [ 'x-auth-token' => $this->requestStack->getCurrentRequest()->headers->get('x-auth-token'), ], ]); } return $result; } }