src/Widop/Twitter/OAuth/OAuth.php
public function sendRequest(OAuthRequest $request)
    {
        switch ($request->getMethod()) {
            case OAuthRequest::METHOD_GET:
                $httpResponse = $this->httpAdapter->getContent($request->getUrl(), $request->getHeaders());
                break;

            case OAuthRequest::METHOD_POST:
                $postParameters = array();
                foreach ($request->getPostParameters() as $name => $value) {
                    $postParameters[rawurldecode($name)] = rawurldecode($value);
                }

                $httpResponse = $this->httpAdapter->postContent(
                    $request->getUrl(),
                    $request->getHeaders(),
                    $postParameters,
                    $request->getFileParameters()
                );
                break;

            default:
                throw new \RuntimeException(sprintf(
                    'The request method "%s" is not supported.',
                    $request->getMethod()
                ));
        }

        $response = new OAuthResponse($httpResponse, $request->getResponseFormat());

        if (!$response->isValid()) {
            throw new OAuthException('The http response is not valid.', $response);
        }

        return $response;
    }
public function sendRequest(OAuthRequest $request)
    {
        switch ($request->getMethod()) {
            case OAuthRequest::METHOD_GET:
                $httpResponse = $this->httpAdapter->getContent($request->getUrl(), $request->getHeaders());
                break;

            case OAuthRequest::METHOD_POST:
                $postParameters = array();
                foreach ($request->getPostParameters() as $name => $value) {
                    $postParameters[rawurldecode($name)] = rawurldecode($value);
                }

                $httpResponse = $this->httpAdapter->postContent(
                    $request->getUrl(),
                    $request->getHeaders(),
                    $postParameters,
                    $request->getFileParameters()
                );
                break;

            default:
                throw new \RuntimeException(sprintf(
                    'The request method "%s" is not supported.',
                    $request->getMethod()
                ));
        }

        $response = new OAuthResponse($httpResponse, $request->getResponseFormat());

        if (!$response->isValid()) {
            throw new OAuthException('The http response is not valid.', $response);
        }

        return $response;
    }
public function sendRequest ( OAuthRequest $ request ) { switch ( $ request -> getMethod ( ) ) { case OAuthRequest :: METHOD_GET : $ httpResponse = $ this -> httpAdapter -> getContent ( $ request -> getUrl ( ) , $ request -> getHeaders ( ) ) ; break ; case OAuthRequest :: METHOD_POST : $ postParameters = array ( ) ; foreach ( $ request -> getPostParameters ( ) as $ name => $ value ) { $ postParameters [ rawurldecode ( $ name ) ] = rawurldecode ( $ value ) ; } $ httpResponse = $ this -> httpAdapter -> postContent ( $ request -> getUrl ( ) , $ request -> getHeaders ( ) , $ postParameters , $ request -> getFileParameters ( ) ) ; break ; default : throw new \ RuntimeException ( sprintf ( 'The request method "%s" is not supported.' , $ request -> getMethod ( ) ) ) ; } $ response = new OAuthResponse ( $ httpResponse , $ request -> getResponseFormat ( ) ) ; if ( ! $ response -> isValid ( ) ) { throw new OAuthException ( 'The http response is not valid.' , $ response ) ; } return $ response ; }
Sends an OAuth request.

@param \Widop\Twitter\OAuth\OAuthRequest $request The OAuth request.

@throws \RuntimeException If the request method is not supported.

@return \Widop\Twitter\OAuth\OAuthResponse The OAuth response.
Sends an OAuth request .