Skip to content

Commit 4932f95

Browse files
committed
Format source according to project standards (#4).
1 parent ce4d060 commit 4932f95

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

src/CurlHttpClient.php

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,10 @@
1212
use Http\Message\MessageFactoryAwareTemplate;
1313
use Http\Message\StreamFactory;
1414
use Http\Message\StreamFactoryAwareTemplate;
15-
use InvalidArgumentException;
1615
use Psr\Http\Message\RequestInterface;
1716
use Psr\Http\Message\ResponseInterface;
18-
use RuntimeException;
19-
use UnexpectedValueException;
2017

2118
/**
22-
* Use php cURL extension to perform HTTP requests
23-
*
2419
* @author Kemist <kemist1980@gmail.com>
2520
* @author Михаил Красильников <m.krasilnikov@yandex.ru>
2621
* @author Blake Williams <github@shabbyrobe.org>
@@ -98,8 +93,8 @@ public function __destruct()
9893
*
9994
* @return ResponseInterface
10095
*
101-
* @throws UnexpectedValueException if unsupported HTTP version requested
102-
* @throws InvalidArgumentException
96+
* @throws \UnexpectedValueException if unsupported HTTP version requested
97+
* @throws \InvalidArgumentException
10398
* @throws RequestException
10499
*
105100
* @since 1.00
@@ -110,7 +105,7 @@ public function sendRequest(RequestInterface $request)
110105

111106
try {
112107
$this->request($options, $raw, $info);
113-
} catch (RuntimeException $e) {
108+
} catch (\RuntimeException $e) {
114109
throw new RequestException($e->getMessage(), $request, $e);
115110
}
116111

@@ -168,7 +163,7 @@ public function sendRequest(RequestInterface $request)
168163
* @param string $raw raw response
169164
* @param array $info cURL response info
170165
*
171-
* @throws RuntimeException on cURL error
166+
* @throws \RuntimeException on cURL error
172167
*
173168
* @since 1.00
174169
*/
@@ -184,7 +179,7 @@ protected function request($options, &$raw, &$info)
184179
$raw = curl_exec($this->handle);
185180

186181
if (curl_errno($this->handle) > 0) {
187-
throw new RuntimeException(
182+
throw new \RuntimeException(
188183
sprintf(
189184
'Curl error: (%d) %s',
190185
curl_errno($this->handle),
@@ -200,7 +195,7 @@ protected function request($options, &$raw, &$info)
200195
*
201196
* @param RequestInterface $request
202197
*
203-
* @throws UnexpectedValueException if unsupported HTTP version requested
198+
* @throws \UnexpectedValueException if unsupported HTTP version requested
204199
*
205200
* @return array
206201
*/
@@ -220,7 +215,7 @@ private function createCurlOptions(RequestInterface $request)
220215
$options[CURLOPT_TIMEOUT] = $this->settings['timeout'];
221216

222217
if (in_array($request->getMethod(), ['OPTIONS', 'POST', 'PUT'], true)) {
223-
/* cURL allows request body only for these methods. */
218+
// cURL allows request body only for these methods.
224219
$body = (string) $request->getBody();
225220
if ('' !== $body) {
226221
$options[CURLOPT_POSTFIELDS] = $body;
@@ -230,7 +225,7 @@ private function createCurlOptions(RequestInterface $request)
230225
if ($request->getMethod() === 'HEAD') {
231226
$options[CURLOPT_NOBODY] = true;
232227
} elseif ($request->getMethod() !== 'GET') {
233-
/* GET is a default method. Other methods should be specified explicitly. */
228+
// GET is a default method. Other methods should be specified explicitly.
234229
$options[CURLOPT_CUSTOMREQUEST] = $request->getMethod();
235230
}
236231

@@ -248,7 +243,7 @@ private function createCurlOptions(RequestInterface $request)
248243
*
249244
* @param string $requestVersion
250245
*
251-
* @throws UnexpectedValueException if unsupported version requested
246+
* @throws \UnexpectedValueException if unsupported version requested
252247
*
253248
* @return int
254249
*/
@@ -263,7 +258,7 @@ private function getProtocolVersion($requestVersion)
263258
if (defined('CURL_HTTP_VERSION_2_0')) {
264259
return CURL_HTTP_VERSION_2_0;
265260
}
266-
throw new UnexpectedValueException('libcurl 7.33 needed for HTTP 2.0 support');
261+
throw new \UnexpectedValueException('libcurl 7.33 needed for HTTP 2.0 support');
267262
}
268263
return CURL_HTTP_VERSION_NONE;
269264
}

0 commit comments

Comments
 (0)