Ejemplo n.º 1
0
 private function _extract($response, $p)
 {
     if (preg_match($p, $response, $matches) && count($matches) >= 1) {
         return URLUtils::formURLDecode($matches[1]);
     } else {
         throw new OAuthException("Response body is incorrect. Can't extract token" . " and secret from this: '" . $response . "'", null);
     }
 }
Ejemplo n.º 2
0
 public function extract($response)
 {
     Preconditions::checkEmptyString($response, "Response body is incorrect. " . "Can't extract a token from an empty string");
     if (preg_match(self::TOKEN_REGEX, $response, $matches)) {
         $token = URLUtils::formURLDecode($matches[1]);
         return new Token($token, self::EMPTY_SECRET, $response);
     } else {
         throw new OAuthException("Response body is incorrect. Can't extract a " . "token from this: '" . $response . "'", null);
     }
 }