SurveyService - add method that allows to get the "start survey url" using participant's token (instead of whole participant's object)

This commit is contained in:
Meritoo
2017-10-30 19:44:04 +01:00
parent 64e0fb3152
commit ee62e9f148
3 changed files with 35 additions and 7 deletions

View File

@@ -189,6 +189,23 @@ class SurveyService
return false;
}
/**
* Returns url used to start survey for given survey and participant's token
*
* @param int $surveyId ID of survey to start
* @param string $participantToken Token of participant who would like to start survey
* @return string
*/
public function getStartSurveyUrlByToken($surveyId, $participantToken)
{
$baseUrl = $this
->client
->getConfiguration()
->getBaseUrl();
return sprintf($this->startSurveyUrlTemplate, $baseUrl, $surveyId, $participantToken);
}
/**
* Returns url used to start survey for given survey and participant
*
@@ -198,12 +215,7 @@ class SurveyService
*/
public function getStartSurveyUrl($surveyId, Participant $participant)
{
$baseUrl = $this
->client
->getConfiguration()
->getBaseUrl();
return sprintf($this->startSurveyUrlTemplate, $baseUrl, $surveyId, $participant->getToken());
return $this->getStartSurveyUrlByToken($surveyId, $participant->getToken());
}
/**