private function prepare($request)
    {
        $request->prepare();

        $curlOptions = $this->composeCurlOptions($request->getOptions());

        $method = strtoupper($request->getMethod());
        switch ($method) {
            case 'POST':
                $curlOptions[CURLOPT_POST] = true;
                break;
            default:
                $curlOptions[CURLOPT_CUSTOMREQUEST] = $method;
        }

        $content = $request->getContent();

        if ($method === 'HEAD') {
            $curlOptions[CURLOPT_NOBODY] = true;
        } else {
            $curlOptions[CURLOPT_POSTFIELDS] = $content;
        }

        $curlOptions[CURLOPT_RETURNTRANSFER] = true;
        $curlOptions[CURLOPT_URL] = $request->getFullUrl();
        $curlOptions[CURLOPT_HTTPHEADER] = $request->composeHeaderLines();

        if ($request->getOutputFile()) {
            $curlOptions[CURLOPT_FILE] = $request->getOutputFile();
        }

        return $curlOptions;
    }
private function prepare($request)
    {
        $request->prepare();

        $curlOptions = $this->composeCurlOptions($request->getOptions());

        $method = strtoupper($request->getMethod());
        switch ($method) {
            case 'POST':
                $curlOptions[CURLOPT_POST] = true;
                break;
            default:
                $curlOptions[CURLOPT_CUSTOMREQUEST] = $method;
        }

        $content = $request->getContent();

        if ($method === 'HEAD') {
            $curlOptions[CURLOPT_NOBODY] = true;
        } else {
            $curlOptions[CURLOPT_POSTFIELDS] = $content;
        }

        $curlOptions[CURLOPT_RETURNTRANSFER] = true;
        $curlOptions[CURLOPT_URL] = $request->getFullUrl();
        $curlOptions[CURLOPT_HTTPHEADER] = $request->composeHeaderLines();

        if ($request->getOutputFile()) {
            $curlOptions[CURLOPT_FILE] = $request->getOutputFile();
        }

        return $curlOptions;
    }
private function prepare ( $ request ) { $ request -> prepare ( ) ; $ curlOptions = $ this -> composeCurlOptions ( $ request -> getOptions ( ) ) ; $ method = strtoupper ( $ request -> getMethod ( ) ) ; switch ( $ method ) { case 'POST' : $ curlOptions [ CURLOPT_POST ] = true ; break ; default : $ curlOptions [ CURLOPT_CUSTOMREQUEST ] = $ method ; } $ content = $ request -> getContent ( ) ; if ( $ method === 'HEAD' ) { $ curlOptions [ CURLOPT_NOBODY ] = true ; } else { $ curlOptions [ CURLOPT_POSTFIELDS ] = $ content ; } $ curlOptions [ CURLOPT_RETURNTRANSFER ] = true ; $ curlOptions [ CURLOPT_URL ] = $ request -> getFullUrl ( ) ; $ curlOptions [ CURLOPT_HTTPHEADER ] = $ request -> composeHeaderLines ( ) ; if ( $ request -> getOutputFile ( ) ) { $ curlOptions [ CURLOPT_FILE ] = $ request -> getOutputFile ( ) ; } return $ curlOptions ; }
Prepare request for execution, creating cURL resource for it.
@param Request $request request instance.
@return array cURL options.
Prepare request for execution creating cURL resource for it .