Exemplo n.º 1
0
 /**
  * Encodes a token from parameters and returns an instance of this class.
  *
  * The encoded token can be obtained using the {@link getEncoded()} method.
  *
  * @param Authorization $authorization the authorisation to use to create
  * this token
  * @param array $scope the scope of this token - this must be a subset
  * of the scope provided in `$authorization`
  * @param int $expires_in the time to expiry or {@link Token::TTL_PERPETUAL}
  * @param TokenSource $source_id if the token is created from a previous authorisation
  * code or refresh token, the ID of those artefacts
  * @param array $additional any additional data to be stored on the server for this token
  * @return AccessToken|null 
  */
 public static function create($authorization, $scope = array(), $expires_in = Token::TTL_PERPETUAL, $source = NULL, $additional = array())
 {
     $token = new AccessToken();
     $token->init($authorization, $scope, $expires_in, $source, $additional);
     $token->encode();
     $token->is_parsed = true;
     return $token;
 }