* @copyright Meritoo.pl */ class ParticipantShort extends BaseParticipant { const className = 'Meritoo\LimeSurvey\ApiClient\Result\Item\ParticipantShort'; /** * {@inheritdoc} */ public function setValue($property, $value) { switch ($property) { case 'tid': $this->id = (int)$value; break; case 'participant_info': $this->firstName = trim($value['firstname']); $this->lastName = trim($value['lastname']); $this->email = trim($value['email']); break; } } /** * Returns short data of participant created from full data of participant * * @param Participant $participant Full data of participant * @return $this */ public static function fromParticipant(Participant $participant) { $info = [ 'firstname' => $participant->getFirstName(), 'lastname' => $participant->getLastName(), 'email' => $participant->getEmail(), ]; $data = [ 'tid' => $participant->getId(), 'participant_info' => $info, ]; return new self($data); } }