Remove tokens

@param \CampaignChain\Security\Authentication\Client\OAuthBundle\Entity\Token $tokens
965887
public function removeToken(\CampaignChain\Security\Authentication\Client\OAuthBundle\Entity\Token $tokens)
    {
        $this->tokens->removeElement($tokens);
    }
997951
private function normalizeTokens(array $tokens)
    {
        $nTokens = array();
        for ($i=0,$c=count($tokens); $i<$c; $i++) {
            $token = $tokens[$i];

            if (is_string($token)) {
                $nTokens[] = new LiteralToken($token, end($nTokens)->getEndLine());
                continue;
            }

            switch ($token[0]) {
                case T_WHITESPACE:
                    $lines = explode("\n", $token[1]);
                    for ($j=0,$k=count($lines); $j<$k; $j++) {
                        $line = $lines[$j].($j+1 === $k ? '' : "\n");

                        if ($j+1 === $k && '' === $line) {
                            break;
                        }

                        $nTokens[] = new PhpToken(array(T_WHITESPACE, $line, $token[2] + $j));
                    }
                    break;

                default:
                    // remove any trailing whitespace of the token
                    if (preg_match('/^(.*?)(\s+)$/', $token[1], $match)) {
                        $nTokens[] = new PhpToken(array($token[0], $match[1], $token[2]));

                        // if the next token is whitespace, change it
                        if (isset($tokens[$i+1]) && !is_string($tokens[$i+1])
                                && T_WHITESPACE === $tokens[$i+1][0]) {
                            $tokens[$i+1][1] = $match[2].$tokens[$i+1][1];
                            $tokens[$i+1][2] = $token[2];
                        } else {
                            $nTokens[] = new PhpToken(array(T_WHITESPACE, $match[2], $token[2]));
                        }
                    } else {
                        $nTokens[] = new PhpToken($token);
                    }
            }
        }

        return $nTokens;
    }
854874
public function setSessionTokens($token, $tokenSecret = null)
    {
        $this->session->set(self::SESSION_TOKEN_KEY, $token);
        $this->session->set(self::SESSION_TOKEN_SECRET_KEY, $tokenSecret);
    }
728955
private function clearStandaloneLines(array &$nodes, array &$tokens)
    {
        if ($this->lineTokens > 1) {
            // this is the third or later node on this line, so it can't be standalone
            return;
        }

        $prev = null;
        if ($this->lineTokens === 1) {
            // this is the second node on this line, so it can't be standalone
            // unless the previous node is whitespace.
            if ($prev = end($nodes)) {
                if (!$this->tokenIsWhitespace($prev)) {
                    return;
                }
            }
        }

        if ($next = reset($tokens)) {
            // If we're on a new line, bail.
            if ($next[Mustache_Tokenizer::LINE] !== $this->lineNum) {
                return;
            }

            // If the next token isn't whitespace, bail.
            if (!$this->tokenIsWhitespace($next)) {
                return;
            }

            if (count($tokens) !== 1) {
                // Unless it's the last token in the template, the next token
                // must end in newline for this to be standalone.
                if (substr($next[Mustache_Tokenizer::VALUE], -1) !== "\n") {
                    return;
                }
            }

            // Discard the whitespace suffix
            array_shift($tokens);
        }

        if ($prev) {
            // Return the whitespace prefix, if any
            return array_pop($nodes);
        }
    }
686301
public function removeTokenParserBroker(Twig_TokenParserBroker $broker)
    {
        if (false !== $pos = array_search($broker, $this->brokers)) {
            unset($this->brokers[$pos]);
        }
    }
956709
public function cleanUpUnassignedTokens(array $tokens)
    {
        $this->em->clear();
        foreach ($tokens as $token) {
            $token = $this->em->merge($token);
            $this->em->remove($token);
        }

        $this->em->flush();
    }
544098
private function filterTokensByClass(array $tokens, $tokenClass)
    {
        return array_filter(
            $tokens,
            function (Token $token) use ($tokenClass) {
                return get_class($token) === $tokenClass;
            }
        );
    }
1059611
public function deleteAuthToken(EndpointsToken $Token) {
    $url = URIResource::Make($this->path, array($this->id, 'tokens', $Token->token));
    return $this->client->delete($url);
  }
1250839
public void setTokens(Map<String, String> tokens) {
        tokenValues.clear();
        tokenValues.putAll(tokens);
    }
509303
public function deleteToken($token)
    {
        return $this->queryBuilder->from($this->getTokenTable())
            ->where('token', $token)
            ->delete();
    }
727481
public function invalidateToken( $service ) {
        unset( $this->tokens[$service] );

        $cacheKey = $this->getTokenCacheKey( $service );
        $this->client->cache->delete( $cacheKey );

        $this->client->logger->notice( 'Invalidated token for ' . ucfirst( $service ) . 'Service' );
    }
1222333
protected function releaseToken($tokenIdentifier)
    {
        $filtered = array_filter($this->tokens, function ($val) use ($tokenIdentifier) {
            return $val['token'] === $tokenIdentifier;
        });
        $keys = array_keys($filtered);
        $this->tokens[$keys[0]]['available'] = true;
    }
1037551
protected function separateActiveAndInactiveTokens(array $tokens)
    {
        if ($this->request === null) {
            return;
        }

        /** @var $token TokenInterface */
        foreach ($tokens as $token) {
            if ($this->isTokenActive($token)) {
                $this->activeTokens[$token->getAuthenticationProviderName()] = $token;
            } else {
                $this->inactiveTokens[$token->getAuthenticationProviderName()] = $token;
            }
        }
    }
630246
protected function revokeOrDeleteAccessTokens(Token $token, $tokenId)
    {
        $query = Token::where('user_id', $token->user_id)->where('client_id', $token->client_id);

        if ($tokenId) {
            $query->where('id', '<>', $tokenId);
        }

        if (Passport::$pruneRevokedTokens) {
            $query->delete();
        } else {
            $query->update(['revoked' => true]);
        }
    }
62647
public static function delete($token, array $params = array())
    {
        $params = array_merge($params, array('token_id' => $token));

        return self::invoke(__FUNCTION__, static::RESOURCE_NAME, $params);
    }
801227
protected static function _tokenize(array $tokens) {
		$inString = false;
		$results = array();
		$cpt = 0;
		$previousTokenId = null;
		foreach ($tokens as $tokenId => $token) {
			if ($token['content'] === '"') {
				if (!$inString) {
					$token['id'] = T_START_DOUBLE_QUOTE;
					$token['name'] = 'T_START_DOUBLE_QUOTE';
				} else {
					$token['id'] = T_END_DOUBLE_QUOTE;
					$token['name'] = 'T_END_DOUBLE_QUOTE';
				}
				$inString = !$inString;
			}

			$isCurlyBrace = (
				$token['content'] === '$' &&
				isset($tokens[$tokenId + 1]) &&
				$tokens[$tokenId + 1]['content'] === '{'
			);
			if ($isCurlyBrace) {
				$token['id'] = T_DOLLAR_CURLY_BRACES;
				$token['name'] = 'T_DOLLAR_CURLY_BRACES';
			}

			$isArray = (
				!$token['id'] &&
				$token['content'] === '(' &&
				$previousTokenId !== null &&
				$tokens[$previousTokenId]['id'] === T_ARRAY
			);
			if ($isArray) {
				$token['id'] = T_ARRAY_OPEN;
				$token['name'] = 'T_ARRAY_OPEN';
			}

			$isShortArray = (
				!$token['id'] &&
				$token['content'] === '[' &&
				$previousTokenId !== null && (
					$tokens[$previousTokenId]['id'] !== T_VARIABLE &&
					$tokens[$previousTokenId]['id'] !== T_ENCAPSED_AND_WHITESPACE
				)
			);
			if ($isShortArray) {
				$token['id'] = T_SHORT_ARRAY_OPEN;
				$token['name'] = 'T_SHORT_ARRAY_OPEN';
			}

			if ($token['content'] === '(' && !$token['id']) {
				$token['id'] = T_START_BRACKET;
				$token['name'] = 'T_START_BRACKET';
			}

			if ($token['id'] !== T_WHITESPACE) {
				$previousTokenId = $tokenId;
			}

			if ($token['id'] === T_IF) {
				$i = $cpt;
				$spaces = '';
				while ($i-- > 0 && $results[$i]['id'] === T_WHITESPACE) {
					$spaces = $results[$i]['content'] . $spaces;
				}
				if ($i >= 0 && $results[$i]['id'] === T_ELSE) {
					$token['id'] = T_ELSEIF;
					$token['name'] = 'T_ELSEIF';
					$token['content'] = $results[$i]['content'] . $spaces . $token['content'];
					$cpt = $i;
				}
			}

			$results[$cpt++] = $token;
		}

		return $results;
	}
42736
public function deleteToken($token)
    {
        $tokenObject = $this->findToken($token);

        if ($tokenObject == null) {
            return (false);
        }
        $this->call($this->tyrUrl . '/' . $this->version . '/users/' . $this->user->id . '/keys/' . $tokenObject->id .'/', 'DELETE');
        return true;
    }