8000 Merge branch 'ahmadnassri-master' into develop · oauth-io/sdk-php@c37a075 · GitHub
[go: up one dir, main page]

Skip to content

Commit c37a075

Browse files
committed
Merge branch 'ahmadnassri-master' into develop
2 parents c9cdd53 + e9c04e3 commit c37a075

File tree

2 files changed

+12
-26
lines changed

2 files changed

+12
-26
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "oauth-io/oauth",
33
"description": "OAuth that just works !",
44
"license": "Apache2",
5-
"version": "0.3.0",
5+
"version": "0.3.1",
66
"authors": [
77
{
88
"name": "oauth-io",
@@ -12,7 +12,7 @@
1212
"minimum-stability": "dev",
1313
"require": {
1414
"php": ">=5.3.0",
15-
"mashape/unirest-php" : "dev-master"
15+
"mashape/unirest-php" : "2.2.*"
1616
},
1717
"autoload": {
1818
"psr-0": {

src/OAuth_io/HttpWrapper.php

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
<?php
2-
namespace OAuth_io;
32

3+
4+
5+
namespace OAuth_io;
6+
use Unirest\Request as Request;
47
class HttpWrapper {
58
public function __create() {
69
}
7-
10+
811
private function array_map_recursive($callback, $array) {
912
foreach ($array as $key => $value) {
1013
if (is_object($array[$key])) {
@@ -15,10 +18,10 @@ private function array_map_recursive($callback, $array) {
1518
}
1619
return $array;
1720
}
18-
21+
1922
public function make_request($options) {
2023
$injector = Injector::getInstance();
21-
24+
2225
$url = $options['url'];
2326
$method = $options['method'];
2427
$headers = $options['headers'];
@@ -30,26 +33,9 @@ public function make_request($options) {
3033
}
3134
$url = str_replace('%2C', ',', $url);
3235

33-
\Unirest::verifyPeer($injector->ssl_verification);
34-
if ($options['method'] == 'GET') {
35-
$response = \Unirest::get($url, $headers);
36-
}
37-
38-
if ($options['method'] == 'POST') {
39-
$response = \Unirest::post($url, $headers, $body);
40-
}
41-
42-
if ($options['method'] == 'PUT') {
43-
$response = \Unirest::put($url, $headers, $body);
44-
}
45-
46-
if ($options['method'] == 'DELETE') {
47-
$response = \Unirest::delete($url, $headers);
48-
}
49-
50-
if ($options['method'] == 'PATCH') {
51-
$response = \Unirest::patch($url, $headers, $body);
52-
}
36+
37+
Request::verifyPeer($injector->ssl_verification);
38+
$response = Request::send($options['method'], $url, $body, $headers);
5339

5440
return $response;
5541
}

0 commit comments

Comments
 (0)
0