protected function _parseBearerReply($result, $httpstatus)
  {
    list($headers, $reply) = $this->_parseApiHeaders($result);
    $reply                 = $this->_parseApiReply($reply);
    $rate                  = $this->_getRateLimitInfo($headers);
    switch ($this->_return_format) {
      case CODEBIRD_RETURNFORMAT_ARRAY:
        $reply['httpstatus'] = $httpstatus;
        $reply['rate']       = $rate;
        if ($httpstatus === 200) {
          self::setBearerToken($reply['access_token']);
        }
        break;
      case CODEBIRD_RETURNFORMAT_JSON:
        if ($httpstatus === 200) {
          $parsed = $this->_json_decode($reply);
          self::setBearerToken($parsed->access_token);
        }
        break;
      case CODEBIRD_RETURNFORMAT_OBJECT:
        $reply->httpstatus = $httpstatus;
        $reply->rate       = $rate;
        if ($httpstatus === 200) {
          self::setBearerToken($reply->access_token);
        }
        break;
    }
    return $reply;
  }
protected function _parseBearerReply($result, $httpstatus)
  {
    list($headers, $reply) = $this->_parseApiHeaders($result);
    $reply                 = $this->_parseApiReply($reply);
    $rate                  = $this->_getRateLimitInfo($headers);
    switch ($this->_return_format) {
      case CODEBIRD_RETURNFORMAT_ARRAY:
        $reply['httpstatus'] = $httpstatus;
        $reply['rate']       = $rate;
        if ($httpstatus === 200) {
          self::setBearerToken($reply['access_token']);
        }
        break;
      case CODEBIRD_RETURNFORMAT_JSON:
        if ($httpstatus === 200) {
          $parsed = $this->_json_decode($reply);
          self::setBearerToken($parsed->access_token);
        }
        break;
      case CODEBIRD_RETURNFORMAT_OBJECT:
        $reply->httpstatus = $httpstatus;
        $reply->rate       = $rate;
        if ($httpstatus === 200) {
          self::setBearerToken($reply->access_token);
        }
        break;
    }
    return $reply;
  }
protected function _parseBearerReply ( $ result , $ httpstatus ) { list ( $ headers , $ reply ) = $ this -> _parseApiHeaders ( $ result ) ; $ reply = $ this -> _parseApiReply ( $ reply ) ; $ rate = $ this -> _getRateLimitInfo ( $ headers ) ; switch ( $ this -> _return_format ) { case CODEBIRD_RETURNFORMAT_ARRAY : $ reply [ 'httpstatus' ] = $ httpstatus ; $ reply [ 'rate' ] = $ rate ; if ( $ httpstatus === 200 ) { self :: setBearerToken ( $ reply [ 'access_token' ] ) ; } break ; case CODEBIRD_RETURNFORMAT_JSON : if ( $ httpstatus === 200 ) { $ parsed = $ this -> _json_decode ( $ reply ) ; self :: setBearerToken ( $ parsed -> access_token ) ; } break ; case CODEBIRD_RETURNFORMAT_OBJECT : $ reply -> httpstatus = $ httpstatus ; $ reply -> rate = $ rate ; if ( $ httpstatus === 200 ) { self :: setBearerToken ( $ reply -> access_token ) ; } break ; } return $ reply ; }
Parse oauth2_token reply and set bearer token, if found

@param string $result     Raw HTTP response
@param int    $httpstatus HTTP status code

@return string reply
Parse oauth2_token reply and set bearer token if found