Returns the previous token that has succes in this track

@return \Gems_Tracker_Token
510326
public function getPreviousSuccessToken()
    {
        $prev = $this->getPreviousToken();

        while ($prev && (! $prev->hasSuccesCode())) {
            $prev = $prev->getPreviousToken();
        }

        return $prev;
    }
649457
public function peekNextToken() {
		if ($this->index < (count($this->tokens) - 1)) {
			return $this->tokens[$this->index + 1];
		} else {
			return null;
		}
	}
1294691
private function getCookieId()
    {
        return $this->trackIfEnabled('cookies', function () {
            return ! is_null($name = $this->getConfig('cookie.name'))
                ? $this->getCookieTracker()->track($this->request->cookie($name))
                : null;
        });
    }
829350
public function getSyncToken()
    {
        if (
            $this->caldavBackend instanceof Backend\SyncSupport &&
            isset($this->calendarInfo['{DAV:}sync-token'])
        ) {
            return $this->calendarInfo['{DAV:}sync-token'];
        }
        if (
            $this->caldavBackend instanceof Backend\SyncSupport &&
            isset($this->calendarInfo['{http://sabredav.org/ns}sync-token'])
        ) {
            return $this->calendarInfo['{http://sabredav.org/ns}sync-token'];
        }
    }
1192359
public function getTokenExpire()
    {
        return $this->_state->token->obtained
            + $this->_state->token->data->expires_in - time();
    }
104890
public function getToken(): string
    {
        return $this->cache->remember($this->tokenKey, $this->tokenTTL, function () {
            return $this->fetchToken();
        });
    }
492966
public function getToken()
    {
        if (!isset($this->token)) {
            $this->token = $this->csrf->getToken();
        }

        return $this->token;
    }
1225745
public function getFirstToken()
    {
        if (! $this->_firstToken) {
            if (! $this->_tokens) {
                //No cache yet, but we might need all tokens later
                $this->getTokens();
            }
            $this->_firstToken = reset($this->_tokens);
        }

        return $this->_firstToken;
    }
347965
protected function _initToken()
    {
        if ($this->tracker) {
            return $this->token && $this->token->exists;
        }

        $this->tracker = $this->loader->getTracker();
        $this->tokenId = $this->tracker->filterToken($this->_getParam(\MUtil_Model::REQUEST_ID));
        // Now check if the token is valid
        $validator = $this->tracker->getTokenValidator();

        if (! $this->tokenId || $validator->isValid($this->tokenId) === false) {
            return false;
        }

        $this->token = $this->tracker->getToken($this->tokenId);

        if (! $this->token->exists) {
            return false;
        }

        if (! ($this->currentUser->isActive() || $this->token->getSurvey()->isTakenByStaff())) {
            $tokenLang = strtolower($this->token->getRespondentLanguage());
            // \MUtil_Echo::track($tokenLang, $this->locale->getLanguage());
            if ($tokenLang != $this->locale->getLanguage()) {
                $this->currentUser->switchLocale($tokenLang);
            }

            $currentOrg = $this->loader->getOrganization();
            $tokenOrgId = $this->token->getOrganizationId();

            if ($tokenOrgId != $currentOrg->getId()) {
                $this->loader->getOrganization($tokenOrgId)
                        ->setAsCurrentOrganization();
            }
        }

        return true;
    }
840394
public function getToken()
    {
        if(isset($this->_tokens[$this->_position])) {
            return $this->_tokens[$this->_position];
        } else {
            return null;
        }
    }
1237754
public function getToken()
    {
        $token = $this->cache->get($this->tokenName);
        if ($token === false) {
            $token = Algorithms::generateRandomToken(20);
            $this->storeToken($token);
        }
        return $token;
    }
18256
public function getPresetTargetData()
    {
        $targetData = parent::getPresetTargetData();
        if ($this->token) {
            $targetData['track']        = $this->token->getTrackName();
            $targetData['round']        = $this->token->getRoundDescription();
            $targetData['survey']       = $this->token->getSurvey()->getName();
            $targetData['last_contact'] = $this->token->getMailSentDate();
        }
        return $targetData;
    }
225981
public function getNext()
    {
        for (; $this->idx < $this->count; ++$this->idx) {
            if (($this->tokens[$this->idx]->type !== Token::TYPE_WHITESPACE)
                && ($this->tokens[$this->idx]->type !== Token::TYPE_COMMENT)
            ) {
                return $this->tokens[$this->idx++];
            }
        }

        return null;
    }
331324
public function removeToken($token)
    {
        if ($token instanceof \Gems_Tracker_Token) {
            $tokenId = $token->getTokenId();
        } else {
            $tokenId = $token;
        }
        unset($this->_tokens[$tokenId]);

        return $this;
    }
937185
protected function _isTokenInFilter(\Gems_Tracker_Token $token)
    {
        $result = false;

        // Only if token has a success code
        if ($token->getReceptionCode()->isSuccess()) {
            $result = true;
        }

        if ($result) {
            $tokenInfo = array(
                'code'     => $token->getSurvey()->getCode(),
                'surveyid' => $token->getSurveyId(),
                'tokenid'  => $token->getTokenId()
            );

            // Now check if the tokenfilter is true
            if (empty($this->tokenFilter)) {
                $result = true;
            } else {
                $result = false;
                // Now read the filter and split by track code or track id
                foreach ($this->tokenFilter as $filter)
                {
                    $remaining = array_diff_assoc($filter, $tokenInfo);
                    if (empty($remaining)) {
                        $result = true;
                        break;
                    }
                }
            }
        }

        return $result;
    }
1288935
public function processTokenInsertion(\Gems_Tracker_Token $token)
    {
        if ($token->hasSuccesCode() && (! $token->isCompleted())) {
            // Preparation for a more general object class
            $surveyId   = $token->getSurveyId();

            $prev = $token;
            while ($prev = $prev->getPreviousToken()) {

                if ($prev->hasSuccesCode() && $prev->isCompleted()) {
                    // Check first on survey id and when that does not work by name.
                    if ($prev->getSurveyId() == $surveyId) {
                        return $prev->getRawAnswers();
                    }
                }
            }
        }
    }
305868
public function getPreviousCharacter()
	{
		$previous = prev($this->characters);

		if ($previous === false && $this->chunker->hasPreviousChunk()) {
			$this->read($this->chunker->getPreviousChunk());
			$previous = end($this->characters);
		}
		
		return $previous;
	}