diff --git a/src/Base/Result/BaseParticipant.php b/src/Base/Result/BaseParticipant.php new file mode 100644 index 0000000..9e03192 --- /dev/null +++ b/src/Base/Result/BaseParticipant.php @@ -0,0 +1,81 @@ + + * @copyright Meritoo.pl + */ +abstract class BaseParticipant extends BaseItem +{ + /** + * ID of the participant + * + * @var int + */ + protected $id; + + /** + * First name of the participant + * + * @var string + */ + protected $firstName; + + /** + * Last name of the participant + * + * @var string + */ + protected $lastName; + + /** + * E-mail of the participant + * + * @var string + */ + protected $email; + + /** + * Returns ID of the participant + * + * @return int + */ + public function getId() + { + return $this->id; + } + + /** + * Returns first name of the participant + * + * @return string + */ + public function getFirstName() + { + return $this->firstName; + } + + /** + * Returns last name of the participant + * + * @return string + */ + public function getLastName() + { + return $this->lastName; + } + + /** + * Returns e-mail of the participant + * + * @return string + */ + public function getEmail() + { + return $this->email; + } +} diff --git a/src/Base/Result/BaseParticipantsCollection.php b/src/Base/Result/BaseParticipantsCollection.php new file mode 100644 index 0000000..38db099 --- /dev/null +++ b/src/Base/Result/BaseParticipantsCollection.php @@ -0,0 +1,142 @@ + + * @copyright Meritoo.pl + */ +abstract class BaseParticipantsCollection extends Collection +{ + /** + * {@inheritdoc} + */ + public function add($element, $index = null) + { + throw new DisabledMethodException(__METHOD__, 'addParticipant'); + } + + /** + * {@inheritdoc} + */ + public function addMultiple($elements, $useIndexes = false) + { + throw new DisabledMethodException(__METHOD__, 'addParticipants'); + } + + /** + * {@inheritdoc} + */ + public function has($element) + { + throw new DisabledMethodException(__METHOD__, 'hasParticipantsOfSurvey'); + } + + /** + * Adds participants of given survey + * + * @param Collection $participants Participants to add. Collection of ParticipantShort or Participant instances. + * @param int $surveyId ID of survey + * @return $this + */ + public function addParticipants(Collection $participants, $surveyId) + { + /* + * No participants? + * Nothing to do + */ + if ($participants->isEmpty()) { + return $this; + } + + $this + ->getBySurvey($surveyId) + ->addMultiple($participants); + + return $this; + } + + /** + * Returns participants of given survey + * + * If there are no participants of given survey, adds an empty collection who will store participants. + * So, this method will return collection always. + * + * @param int $surveyId ID of survey + * @return Collection + */ + public function getBySurvey($surveyId) + { + /* + * There are no participants of given survey? + * Let's add an empty collection who will store participants + */ + if (!isset($this[$surveyId])) { + $this[$surveyId] = new Collection(); + } + + return $this[$surveyId]; + } + + /** + * Returns information if there are participants of given survey + * + * @param int $surveyId ID of survey + * @return bool + */ + public function hasParticipantsOfSurvey($surveyId) + { + return false === $this + ->getBySurvey($surveyId) + ->isEmpty(); + } + + /** + * Adds participant of given survey + * + * @param BaseParticipant $participant Participant to add + * @param int $surveyId ID of survey + * @return $this + */ + public function addParticipant(BaseParticipant $participant, $surveyId) + { + $this + ->getBySurvey($surveyId) + ->add($participant); + + return $this; + } + + /** + * Returns participant of given survey + * + * @param int $surveyId ID of survey + * @param string $participantEmail E-mail of searched participant + * @return BaseParticipant|null + */ + public function getParticipantOfSurvey($surveyId, $participantEmail) + { + $participants = $this->getBySurvey($surveyId); + + /* + * No participants? + * Nothing to do + */ + if ($participants->isEmpty()) { + return null; + } + + foreach ($participants as $participant) { + if ($participant->getEmail() == $participantEmail) { + return $participant; + } + } + + return null; + } +} diff --git a/src/Result/Collection/Participants.php b/src/Result/Collection/Participants.php index 3036792..3b70749 100644 --- a/src/Result/Collection/Participants.php +++ b/src/Result/Collection/Participants.php @@ -8,9 +8,7 @@ namespace Meritoo\LimeSurvey\ApiClient\Result\Collection; -use Meritoo\Common\Collection\Collection; -use Meritoo\Common\Exception\Method\DisabledMethodException; -use Meritoo\LimeSurvey\ApiClient\Result\Item\ParticipantShort; +use Meritoo\LimeSurvey\ApiClient\Base\Result\BaseParticipantsCollection; /** * Collection of participants' short data. @@ -22,130 +20,6 @@ use Meritoo\LimeSurvey\ApiClient\Result\Item\ParticipantShort; * @author Krzysztof Niziol * @copyright Meritoo.pl */ -class Participants extends Collection +class Participants extends BaseParticipantsCollection { - /** - * {@inheritdoc} - */ - public function add($element, $index = null) - { - throw new DisabledMethodException(__METHOD__, 'addParticipants'); - } - - /** - * {@inheritdoc} - */ - public function addMultiple($elements, $useIndexes = false) - { - throw new DisabledMethodException(__METHOD__, 'addParticipants'); - } - - /** - * {@inheritdoc} - */ - public function has($element) - { - throw new DisabledMethodException(__METHOD__, 'hasParticipantsOfSurvey'); - } - - /** - * Adds participants of given survey - * - * @param Collection $participants Participants to add. Collection of ParticipantShort classes. - * @param int $surveyId ID of survey - * @return $this - */ - public function addParticipants(Collection $participants, $surveyId) - { - /* - * No participants? - * Nothing to do - */ - if ($participants->isEmpty()) { - return $this; - } - - $this - ->getBySurvey($surveyId) - ->addMultiple($participants); - - return $this; - } - - /** - * Adds participant of given survey - * - * @param ParticipantShort $participant Participant to add - * @param int $surveyId ID of survey - * @return $this - */ - public function addParticipant(ParticipantShort $participant, $surveyId) - { - $this - ->getBySurvey($surveyId) - ->add($participant); - - return $this; - } - - /** - * Returns information if there are participants of given survey - * - * @param int $surveyId ID of survey - * @return bool - */ - public function hasParticipantsOfSurvey($surveyId) - { - return false === $this - ->getBySurvey($surveyId) - ->isEmpty(); - } - - /** - * Returns participants of given survey - * - * If there are no participants of given survey, adds an empty collection who will store participants. - * So, this method will return collection always. - * - * @param int $surveyId ID of survey - * @return Collection - */ - public function getBySurvey($surveyId) - { - /* - * There are no participants of given survey? - * Let's add an empty collection who will store participants - */ - if (!isset($this[$surveyId])) { - $this[$surveyId] = new Collection(); - } - - return $this[$surveyId]; - } - - /** - * Returns participant of given survey - * - * @param int $surveyId ID of survey - * @param string $participantEmail E-mail of searched participant - * @return ParticipantShort|null - */ - public function getParticipantOfSurvey($surveyId, $participantEmail) - { - /* @var Collection $participants */ - $participants = $this->getBySurvey($surveyId); - - if ($participants->isEmpty()) { - return null; - } - - /* @var ParticipantShort $participant */ - foreach ($participants as $participant) { - if ($participant->getEmail() == $participantEmail) { - return $participant; - } - } - - return null; - } } diff --git a/src/Result/Collection/ParticipantsDetails.php b/src/Result/Collection/ParticipantsDetails.php new file mode 100644 index 0000000..530cc29 --- /dev/null +++ b/src/Result/Collection/ParticipantsDetails.php @@ -0,0 +1,36 @@ + + * @copyright Meritoo.pl + */ +class ParticipantsDetails extends BaseParticipantsCollection +{ + /** + * Returns information if survey with given ID has participant with given e-mail address + * + * @param int $surveyId ID of survey + * @param string $participantEmail E-mail of searched participant + * @return bool + */ + public function hasParticipantOfSurvey($surveyId, $participantEmail) + { + return null !== $this->getParticipantOfSurvey($surveyId, $participantEmail); + } +} diff --git a/src/Result/Item/Participant.php b/src/Result/Item/Participant.php index dcaf49e..eedba4d 100644 --- a/src/Result/Item/Participant.php +++ b/src/Result/Item/Participant.php @@ -10,7 +10,7 @@ namespace Meritoo\LimeSurvey\ApiClient\Result\Item; use DateTime; use Meritoo\Common\Utilities\Date; -use Meritoo\LimeSurvey\ApiClient\Base\Result\BaseItem; +use Meritoo\LimeSurvey\ApiClient\Base\Result\BaseParticipant; /** * One item of the result/data: full data of one participant @@ -18,15 +18,8 @@ use Meritoo\LimeSurvey\ApiClient\Base\Result\BaseItem; * @author Krzysztof Niziol * @copyright Meritoo.pl */ -class Participant extends BaseItem +class Participant extends BaseParticipant { - /** - * ID of the participant - * - * @var int - */ - private $id; - /** * Another ID of the participant? * Don't know where it is used. @@ -42,27 +35,6 @@ class Participant extends BaseItem */ private $mpId; - /** - * First name of the participant - * - * @var string - */ - private $firstName; - - /** - * Last name of the participant - * - * @var string - */ - private $lastName; - - /** - * E-mail of the participant - * - * @var string - */ - private $email; - /** * Status of the e-mail * @@ -229,16 +201,6 @@ class Participant extends BaseItem } } - /** - * Returns ID of the participant - * - * @return int - */ - public function getId() - { - return $this->id; - } - /** * Returns another ID of the participant? * Don't know where it is used. @@ -260,36 +222,6 @@ class Participant extends BaseItem return $this->mpId; } - /** - * Returns first name of the participant - * - * @return string - */ - public function getFirstName() - { - return $this->firstName; - } - - /** - * Returns last name of the participant - * - * @return string - */ - public function getLastName() - { - return $this->lastName; - } - - /** - * Returns e-mail of the participant - * - * @return string - */ - public function getEmail() - { - return $this->email; - } - /** * Returns status of the e-mail * diff --git a/src/Result/Item/ParticipantShort.php b/src/Result/Item/ParticipantShort.php index 67d739a..0ede1fb 100644 --- a/src/Result/Item/ParticipantShort.php +++ b/src/Result/Item/ParticipantShort.php @@ -8,7 +8,7 @@ namespace Meritoo\LimeSurvey\ApiClient\Result\Item; -use Meritoo\LimeSurvey\ApiClient\Base\Result\BaseItem; +use Meritoo\LimeSurvey\ApiClient\Base\Result\BaseParticipant; /** * One item of the result/data: short data of one participant @@ -16,36 +16,8 @@ use Meritoo\LimeSurvey\ApiClient\Base\Result\BaseItem; * @author Krzysztof Niziol * @copyright Meritoo.pl */ -class ParticipantShort extends BaseItem +class ParticipantShort extends BaseParticipant { - /** - * ID of the participant - * - * @var int - */ - private $id; - - /** - * First name of the participant - * - * @var string - */ - private $firstName; - - /** - * Last name of the participant - * - * @var string - */ - private $lastName; - - /** - * E-mail of the participant - * - * @var string - */ - private $email; - /** * {@inheritdoc} */ @@ -64,46 +36,6 @@ class ParticipantShort extends BaseItem } } - /** - * Returns ID of the participant - * - * @return int - */ - public function getId() - { - return $this->id; - } - - /** - * Returns first name of the participant - * - * @return string - */ - public function getFirstName() - { - return $this->firstName; - } - - /** - * Returns last name of the participant - * - * @return string - */ - public function getLastName() - { - return $this->lastName; - } - - /** - * Returns e-mail of the participant - * - * @return string - */ - public function getEmail() - { - return $this->email; - } - /** * Returns short data of participant created from full data of participant * diff --git a/src/Service/ParticipantService.php b/src/Service/ParticipantService.php index 5ae4322..4e4e047 100644 --- a/src/Service/ParticipantService.php +++ b/src/Service/ParticipantService.php @@ -13,6 +13,7 @@ use Meritoo\LimeSurvey\ApiClient\Client\Client; use Meritoo\LimeSurvey\ApiClient\Exception\CannotProcessDataException; use Meritoo\LimeSurvey\ApiClient\Exception\MissingParticipantOfSurveyException; use Meritoo\LimeSurvey\ApiClient\Result\Collection\Participants; +use Meritoo\LimeSurvey\ApiClient\Result\Collection\ParticipantsDetails; use Meritoo\LimeSurvey\ApiClient\Result\Item\Participant; use Meritoo\LimeSurvey\ApiClient\Result\Item\ParticipantShort; use Meritoo\LimeSurvey\ApiClient\Type\MethodType; @@ -41,21 +42,39 @@ class ParticipantService */ private $allParticipants; + /** + * Collection of participants' full data. + * All participants grouped per survey. + * + * @var Participants + */ + private $participantsDetails; + /** * Class constructor * - * @param Client $client Client of the LimeSurvey's API - * @param Participants $allParticipants (optional) Collection of participants' short data. All participants - * grouped per survey. + * @param Client $client Client of the LimeSurvey's API + * @param Participants $allParticipants (optional) Collection of participants' short data. All participants + * grouped per survey. + * @param ParticipantsDetails $participantsDetails (optional) Collection of participants' full data. All + * participants grouped per survey. */ - public function __construct(Client $client, Participants $allParticipants = null) - { + public function __construct( + Client $client, + Participants $allParticipants = null, + ParticipantsDetails $participantsDetails = null + ) { if (null === $allParticipants) { $allParticipants = new Participants(); } + if (null === $participantsDetails) { + $participantsDetails = new ParticipantsDetails(); + } + $this->client = $client; $this->allParticipants = $allParticipants; + $this->participantsDetails = $participantsDetails; } /** @@ -93,13 +112,10 @@ class ParticipantService ->run(MethodType::LIST_PARTICIPANTS, $arguments) ->getData(); } catch (CannotProcessDataException $exception) { - $reason = $exception->getReason(); - /* - * Reason of the exception is different than "Oops, there is no participants. Everything else is fine."? - * Let's throw the exception + * Oops, something is broken, because the reason is different than "there are no participants" */ - if (ReasonType::NO_PARTICIPANTS_FOUND !== $reason) { + if (ReasonType::NO_PARTICIPANTS_FOUND !== $exception->getReason()) { throw $exception; } @@ -125,14 +141,7 @@ class ParticipantService */ public function hasParticipant($surveyId, $email) { - /* - * I have to get all participants of survey to avoid problem when participants exist but are not loaded - */ - $this->getSurveyParticipants($surveyId); - - return null !== $this - ->allParticipants - ->getParticipantOfSurvey($surveyId, $email); + return null !== $this->getParticipantDetails($surveyId, $email); } /** @@ -192,9 +201,12 @@ class ParticipantService */ $this->getSurveyParticipants($surveyId); - return $this + $participant = $this ->allParticipants ->getParticipantOfSurvey($surveyId, $email); + + /* @var ParticipantShort $participant */ + return $participant; } /** @@ -203,22 +215,45 @@ class ParticipantService * @param int $surveyId ID of survey * @param string $email E-mail address of the participant * @return Participant|null + * + * @throws CannotProcessDataException */ public function getParticipantDetails($surveyId, $email) { - $arguments = [ - $surveyId, - [ - 'email' => $email, - ], - ]; + if (!$this->participantsDetails->hasParticipantOfSurvey($surveyId, $email)) { + $participant = null; + + $arguments = [ + $surveyId, + [ + 'email' => $email, + ], + ]; + + try { + /* @var Participant $participant */ + $participant = $this + ->client + ->run(MethodType::GET_PARTICIPANT_PROPERTIES, $arguments) + ->getData(); + } catch (CannotProcessDataException $exception) { + /* + * Oops, something is broken, because the reason is different than "participant was not found" + */ + if (ReasonType::NO_PARTICIPANT_PROPERTIES !== $exception->getReason()) { + throw $exception; + } + } + + if (null !== $participant) { + $this->participantsDetails->addParticipant($participant, $surveyId); + } + } $participant = $this - ->client - ->run(MethodType::GET_PARTICIPANT_PROPERTIES, $arguments) - ->getData(); + ->participantsDetails + ->getParticipantOfSurvey($surveyId, $email); - /* @var Participant $participant */ return $participant; } @@ -234,20 +269,9 @@ class ParticipantService public function hasParticipantFilledSurvey($surveyId, $email) { if ($this->hasParticipant($surveyId, $email)) { - $arguments = [ - $surveyId, - [ - 'email' => $email, - ], - ]; - - /* @var Participant $participant */ - $participant = $this - ->client - ->run(MethodType::GET_PARTICIPANT_PROPERTIES, $arguments) - ->getData(); - - return true === $participant->isCompleted(); + return true === $this + ->getParticipantDetails($surveyId, $email) + ->isCompleted(); } throw new MissingParticipantOfSurveyException($surveyId, $email); diff --git a/src/Type/ReasonType.php b/src/Type/ReasonType.php index 3b7ca81..c0a5f0a 100644 --- a/src/Type/ReasonType.php +++ b/src/Type/ReasonType.php @@ -26,6 +26,13 @@ class ReasonType extends BaseType */ const NO_PARTICIPANTS_FOUND = 'No survey participants found.'; + /** + * Reason of exception when there is no participant's properties/details + * + * @var string + */ + const NO_PARTICIPANT_PROPERTIES = 'Error: No results were found based on your attributes.'; + /** * Reason of exception when there is no surveys * diff --git a/tests/Service/ParticipantServiceTest.php b/tests/Service/ParticipantServiceTest.php index 408cb45..7f02631 100644 --- a/tests/Service/ParticipantServiceTest.php +++ b/tests/Service/ParticipantServiceTest.php @@ -8,6 +8,7 @@ namespace Meritoo\LimeSurvey\Test\ApiClient\Service; +use DateTime; use Exception; use Meritoo\Common\Collection\Collection; use Meritoo\Common\Test\Base\BaseTestCase; @@ -51,7 +52,7 @@ class ParticipantServiceTest extends BaseTestCase public function testConstructorVisibilityAndArguments() { - static::assertConstructorVisibilityAndArguments(ParticipantService::class, OopVisibilityType::IS_PUBLIC, 2, 1); + static::assertConstructorVisibilityAndArguments(ParticipantService::class, OopVisibilityType::IS_PUBLIC, 3, 1); } public function testGetClient() @@ -111,16 +112,49 @@ class ParticipantServiceTest extends BaseTestCase static::assertCount(0, $this->serviceWithParticipants->getSurveyParticipants(3)); } - public function testHasParticipant() + public function testHasParticipantUsingServiceWithoutParticipants() { - $rpcClientManager = $this->getJsonRpcClientManager(3); + $rpcClientManager = $this->getJsonRpcClientManager(2); $sessionManager = $this->getSessionManager(); - $this->createServiceWithoutParticipants($rpcClientManager, $sessionManager); - $this->createServiceWithParticipants($rpcClientManager, $sessionManager); static::assertFalse($this->serviceWithoutParticipants->hasParticipant(1, 'john@scott.com')); static::assertFalse($this->serviceWithoutParticipants->hasParticipant(2, 'john@scott.com')); + } + + public function testHasParticipant() + { + $runMethodCallResults = [ + [ + 'tid' => '123', + 'participant_id' => null, + 'mpid' => null, + 'firstname' => 'John', + 'lastname' => 'Scott', + 'email' => 'john@scott.com', + 'emailstatus' => 'OK', + 'token' => uniqid(), + 'language' => 'pl', + 'blacklisted' => 'N', + 'sent' => 'Y', + 'remindersent' => 'N', + 'remindercount' => 0, + 'completed' => 'N', + 'usesleft' => 10, + 'validfrom' => null, + 'validuntil' => (new DateTime())->format('Y-m-d H:i:s'), + ], + [ + null, + ], + [ + null, + ], + ]; + + $rpcClientManager = $this->getJsonRpcClientManager(3, $runMethodCallResults); + $sessionManager = $this->getSessionManager(); + $this->createServiceWithParticipants($rpcClientManager, $sessionManager); static::assertTrue($this->serviceWithParticipants->hasParticipant(1, 'john@scott.com')); static::assertFalse($this->serviceWithParticipants->hasParticipant(2, 'john@scott.com')); @@ -157,9 +191,11 @@ class ParticipantServiceTest extends BaseTestCase $runMethodCallResults = [ [ - 'firstname' => $firstName, - 'lastname' => $lastName, - 'email' => $email, + [ + 'firstname' => $firstName, + 'lastname' => $lastName, + 'email' => $email, + ], ], ]; @@ -200,14 +236,22 @@ class ParticipantServiceTest extends BaseTestCase $rpcClientManager = $this->getJsonRpcClientManager(1); $this->createServiceWithoutParticipants($rpcClientManager, $sessionManager); + $id = 1; + $firstName = 'John'; + $lastName = 'Scott'; + $email = 'john@scott.com'; + $token = uniqid(); + $runMethodCallResults = [ - 'tid' => 1, - 'firstname' => 'John', - 'lastname' => 'Scott', - 'email' => 'john@scott.com', - 'token' => uniqid(), - 'sent' => 'N', - 'completed' => 'N', + [ + 'tid' => $id, + 'firstname' => $firstName, + 'lastname' => $lastName, + 'email' => $email, + 'token' => $token, + 'sent' => 'N', + 'completed' => 'N', + ], ]; $rpcClientManager = $this->getJsonRpcClientManager(1, $runMethodCallResults); @@ -218,11 +262,11 @@ class ParticipantServiceTest extends BaseTestCase static::assertNull($participant1); static::assertInstanceOf(Participant::class, $participant2); - static::assertEquals($runMethodCallResults['tid'], $participant2->getId()); - static::assertEquals($runMethodCallResults['firstname'], $participant2->getFirstName()); - static::assertEquals($runMethodCallResults['lastname'], $participant2->getLastName()); - static::assertEquals($runMethodCallResults['email'], $participant2->getEmail()); - static::assertEquals($runMethodCallResults['token'], $participant2->getToken()); + static::assertEquals($id, $participant2->getId()); + static::assertEquals($firstName, $participant2->getFirstName()); + static::assertEquals($lastName, $participant2->getLastName()); + static::assertEquals($email, $participant2->getEmail()); + static::assertEquals($token, $participant2->getToken()); static::assertFalse($participant2->isSent()); static::assertFalse($participant2->isCompleted()); static::assertNull($participant2->isBlacklisted()); @@ -243,10 +287,12 @@ class ParticipantServiceTest extends BaseTestCase public function testHasParticipantFilledSurveyUsingExistingParticipant() { $runMethodCallResults = [ - 'firstname' => 'John', - 'lastname' => 'Scott', - 'email' => 'john@scott.com', - 'completed' => 'Y', + [ + 'firstname' => 'John', + 'lastname' => 'Scott', + 'email' => 'john@scott.com', + 'completed' => (new DateTime())->format('Y-m-d H:i'), + ], ]; $rpcClientManager = $this->getJsonRpcClientManager(1, $runMethodCallResults); @@ -298,10 +344,22 @@ class ParticipantServiceTest extends BaseTestCase { $rpcClientManager = $this->createMock(JsonRpcClientManager::class); - $rpcClientManager + $mocker = $rpcClientManager ->expects(static::exactly($runMethodCallCount)) - ->method('runMethod') - ->will(static::returnValue($runMethodCallResults)); + ->method('runMethod'); + + if (!empty($runMethodCallResults)) { + $function = [ + $mocker, + 'willReturnOnConsecutiveCalls', + ]; + + /* + * I have to use the call_user_func_array() function to pass elements of $runMethodCallResults array as + * arguments of the willReturnOnConsecutiveCalls() method + */ + call_user_func_array($function, $runMethodCallResults); + } return $rpcClientManager; } diff --git a/tests/Type/ReasonTypeTest.php b/tests/Type/ReasonTypeTest.php index cb86bf8..13495ec 100644 --- a/tests/Type/ReasonTypeTest.php +++ b/tests/Type/ReasonTypeTest.php @@ -30,10 +30,11 @@ class ReasonTypeTest extends BaseTypeTestCase protected function getAllExpectedTypes() { return [ - 'NOT_EXISTING_SURVEY_ID' => ReasonType::NOT_EXISTING_SURVEY_ID, - 'NO_PARTICIPANTS_FOUND' => ReasonType::NO_PARTICIPANTS_FOUND, - 'NO_SURVEYS_FOUND' => ReasonType::NO_SURVEYS_FOUND, - 'NO_TOKEN_TABLE' => ReasonType::NO_TOKEN_TABLE, + 'NOT_EXISTING_SURVEY_ID' => ReasonType::NOT_EXISTING_SURVEY_ID, + 'NO_PARTICIPANTS_FOUND' => ReasonType::NO_PARTICIPANTS_FOUND, + 'NO_PARTICIPANT_PROPERTIES' => ReasonType::NO_PARTICIPANT_PROPERTIES, + 'NO_SURVEYS_FOUND' => ReasonType::NO_SURVEYS_FOUND, + 'NO_TOKEN_TABLE' => ReasonType::NO_TOKEN_TABLE, ]; }