Stores authorization token passed as an argument.
@param \MangoPay\Libraries\OAuthToken $token Token instance to be stored.
327917
public function Store($token)
    {
        if (!is_writable($this->GetPathToTemporaryFolder())) {
            throw new \MangoPay\Libraries\Exception('Cannot create or write to file ' . $this->GetPathToTemporaryFolder());
        }
        
        $serialized = serialize($token);
        $result = file_put_contents($this->GetPathToFile(), $this->_prefixContent . $serialized, LOCK_EX);
        if ($result === false) {
            throw new \MangoPay\Libraries\Exception('Cannot put token to file');
        }
    }
909473
public function setAccessToken(AccessToken $accessToken)
    {
        if (!$accessToken->isValid()) {
            $accessToken->refresh();
        }

        $this->accessToken = $accessToken;
    }
1251900
public function set($key, $token)
    {
        $tokenFile = fopen($this->storageFolder . $key, 'wb');
        fwrite($tokenFile, $token);
        fclose($tokenFile);
    }
981023
public function setToken($token)
    {
        $this->token = $token instanceof Token ? $token : new Token($token);

        return $this;
    }
268566
protected function store_token($token) {
        if (!$this->system) {
            parent::store_token($token);
            return;
        }

        $this->accesstoken = $token;

        // Create or update a DB record with the new token.
        $persistedtoken = access_token::get_record(['issuerid' => $this->issuer->get('id')]);
        if ($token !== null) {
            if (!$persistedtoken) {
                $persistedtoken = new access_token();
                $persistedtoken->set('issuerid', $this->issuer->get('id'));
            }
            // Update values from $token. Don't use from_record because that would skip validation.
            $persistedtoken->set('token', $token->token);
            if (isset($token->expires)) {
                $persistedtoken->set('expires', $token->expires);
            } else {
                // Assume an arbitrary time span of 1 week for access tokens without expiration.
                // The "refresh_system_tokens_task" is run hourly (by default), so the token probably won't last that long.
                $persistedtoken->set('expires', time() + WEEKSECS);
            }
            $persistedtoken->set('scope', $token->scope);
            $persistedtoken->save();
        } else {
            if ($persistedtoken) {
                $persistedtoken->delete();
            }
        }
    }
833481
public function setAccessToken($token)
    {
        if (!is_object($token) && $token !== null) {
            $token = $this->createToken($token);
        }
        $this->_accessToken = $token;
        $this->saveAccessToken($token);
    }
290793
public function store ($hash, AccessToken $accessToken)
    {
        $key = $this->prefix . $hash;
        $contents = json_encode($accessToken);

        $this->memcached->set($key, $contents);
    }
1356030
protected function processToken($token)
    {
        switch ($token) {
            case ')':
                $this->processTokenClosingParenthesis();
                break;
            case '(':
                $this->processTokenOpeningParenthesis();
                break;
            case self::LOGICAL_OR:
            case self::LOGICAL_AND:
                $this->processTokenLogicalOperator($token);
                break;
            default:
                $this->processTokenCondition($token);
                break;
        }

        return $this;
    }
1016303
public function setToken($token = null)
    {
        if ( ! $token and $this->session->has('googleapi_token') )
        {
            $token = $this->session->get('googleapi_token');
        }

        return $this->client->setAccessToken($token);
    }
73144
protected function setAuthenticationHeader($response, $token = null)
    {
        $token = $token ?: $this->auth->refresh();
        $response->headers->set('Authorization', 'Bearer '.$token);

        return $response;
    }
1228606
public function setAccessToken(AccessToken $token)
    {
        $this->container->get('config')
            ->set('access_token', json_encode($token->jsonSerialize()));
    }
560443
protected function saveToken(AccessToken $token)
    {
        if ($this->config['api_token'] && $this->config['api_token_type'] === 'access') {
            return;
        }
        foreach ($token->jsonSerialize() as $name => $value) {
            if (isset($this->storageKeys[$name])) {
                $this->session->set($this->storageKeys[$name], $value);
            }
        }
        $this->session->save();
    }
1335850
public function store ($hash, AccessToken $accessToken)
    {
        $cacheFile = $this->base . "/{$hash}.token";
        $contents = json_encode($accessToken);

        file_put_contents($cacheFile, $contents);
    }
780936
public function deleteToken(Token $token)
    {
        $this->db
            ->delete('ucms_user_token')
            ->condition('uid', $token->uid)
            ->execute();
    }
1023430
private function setToken(array $token)
    {
        if (is_a($this->container, '\\ArrayAccess')) {
            $this->container['token'] = $token;
            return;
        }

        $this->container->set('token', $token);
    }
501826
public function setAccessTokenCredentials($token, $tokenSecret)
    {
        $this->credentials->setToken($token);
        $this->credentials->setTokenSecret($tokenSecret);
        $this->initOauthRequestClient();
    }
1011334
public function setAccessToken($token)
    {
        if (is_string($token)) {
            $this->accessToken = json_decode($token, true);
        } else {
            $this->accessToken = (array)$token;
        }

        return $this;
    }