public static function realTokenToArray($token)
    {
        $class = get_class($token);

        $tokenArray = array(
            'class' => $class,

            // 'extraParams' => $token->getExtraParams(),
        );

        if(get_class($token) === 'League\OAuth1\Client\Credentials\TokenCredentials' || is_subclass_of($token, '\League\OAuth1\Client\Credentials\TokenCredentials'))
        {
            // OAuth 1.0
            $tokenArray['identifier'] = $token->getIdentifier();
            $tokenArray['secret'] = $token->getSecret();
        }
        elseif(get_class($token) === 'League\OAuth2\Client\Token\AccessToken' || is_subclass_of($token, '\League\OAuth2\Client\Token\AccessToken'))
        {
            // OAuth 2.0
            $tokenArray['accessToken'] = $token->getToken();
            $tokenArray['refreshToken'] = $token->getRefreshToken();
            $tokenArray['endOfLife'] = $token->getExpires();
        }

        return $tokenArray;
    }