@@ -3,18 +3,18 @@ |
||
3 | 3 | |
4 | 4 | class GetKarma extends AbstractRequest { |
5 | 5 | |
6 | - function getApiEndPoint() |
|
7 | - { |
|
8 | - return '/v2/users/karma'; |
|
9 | - } |
|
10 | - function getPayload() |
|
11 | - { |
|
12 | - return array( |
|
13 | - ); |
|
14 | - } |
|
15 | - function getMethod() |
|
16 | - { |
|
17 | - return 'GET'; |
|
18 | - } |
|
6 | + function getApiEndPoint() |
|
7 | + { |
|
8 | + return '/v2/users/karma'; |
|
9 | + } |
|
10 | + function getPayload() |
|
11 | + { |
|
12 | + return array( |
|
13 | + ); |
|
14 | + } |
|
15 | + function getMethod() |
|
16 | + { |
|
17 | + return 'GET'; |
|
18 | + } |
|
19 | 19 | } |
20 | 20 |
@@ -3,37 +3,37 @@ |
||
3 | 3 | |
4 | 4 | class SetLocation extends AbstractRequest { |
5 | 5 | /** |
6 | - * @var Location |
|
7 | - */ |
|
8 | - public $location; |
|
9 | - /** |
|
10 | - * @return Location |
|
11 | - */ |
|
12 | - public function getLocation(): Location |
|
13 | - { |
|
14 | - return $this->location; |
|
15 | - } |
|
16 | - /** |
|
17 | - * @param Location $location |
|
18 | - */ |
|
19 | - public function setLocation(Location $location) |
|
20 | - { |
|
21 | - $this->location = $location; |
|
22 | - } |
|
6 | + * @var Location |
|
7 | + */ |
|
8 | + public $location; |
|
9 | + /** |
|
10 | + * @return Location |
|
11 | + */ |
|
12 | + public function getLocation(): Location |
|
13 | + { |
|
14 | + return $this->location; |
|
15 | + } |
|
16 | + /** |
|
17 | + * @param Location $location |
|
18 | + */ |
|
19 | + public function setLocation(Location $location) |
|
20 | + { |
|
21 | + $this->location = $location; |
|
22 | + } |
|
23 | 23 | |
24 | - function getApiEndPoint() |
|
25 | - { |
|
26 | - return '/v2/users/location'; |
|
27 | - } |
|
28 | - function getPayload() |
|
29 | - { |
|
30 | - return array( |
|
24 | + function getApiEndPoint() |
|
25 | + { |
|
26 | + return '/v2/users/location'; |
|
27 | + } |
|
28 | + function getPayload() |
|
29 | + { |
|
30 | + return array( |
|
31 | 31 | "location" => $this->getLocation()->toArray(), |
32 | - ); |
|
33 | - } |
|
34 | - function getMethod() |
|
35 | - { |
|
36 | - return 'PUT'; |
|
37 | - } |
|
32 | + ); |
|
33 | + } |
|
34 | + function getMethod() |
|
35 | + { |
|
36 | + return 'PUT'; |
|
37 | + } |
|
38 | 38 | } |
39 | 39 |
@@ -5,20 +5,20 @@ discard block |
||
5 | 5 | { |
6 | 6 | public $lastPostId; |
7 | 7 | |
8 | - public $url; |
|
8 | + public $url; |
|
9 | 9 | |
10 | - function setUrl ($url) |
|
11 | - { |
|
12 | - $this->url = $url; |
|
13 | - } |
|
10 | + function setUrl ($url) |
|
11 | + { |
|
12 | + $this->url = $url; |
|
13 | + } |
|
14 | 14 | |
15 | - function getUrl () |
|
16 | - { |
|
17 | - return $this->url; |
|
18 | - } |
|
15 | + function getUrl () |
|
16 | + { |
|
17 | + return $this->url; |
|
18 | + } |
|
19 | 19 | |
20 | - function setLastPostId ($lastPostId) |
|
21 | - { |
|
20 | + function setLastPostId ($lastPostId) |
|
21 | + { |
|
22 | 22 | $this->lastPostId = $lastPostId; |
23 | 23 | } |
24 | 24 | |
@@ -27,22 +27,22 @@ discard block |
||
27 | 27 | return $this->lastPostId; |
28 | 28 | } |
29 | 29 | |
30 | - function getApiEndPoint() |
|
31 | - { |
|
32 | - $apiEndPoint = $this->getUrl(); |
|
33 | - //echo $GLOBALS['lastPostId']; |
|
34 | - if ($this->getLastPostId() != "") { |
|
30 | + function getApiEndPoint() |
|
31 | + { |
|
32 | + $apiEndPoint = $this->getUrl(); |
|
33 | + //echo $GLOBALS['lastPostId']; |
|
34 | + if ($this->getLastPostId() != "") { |
|
35 | 35 | $apiEndPoint = $this->getUrl() . '/location/?after=' . $this->getLastPostId(); |
36 | 36 | } |
37 | - return $apiEndPoint; |
|
38 | - } |
|
39 | - function getPayload() |
|
40 | - { |
|
41 | - return array( |
|
42 | - ); |
|
43 | - } |
|
44 | - function getMethod() |
|
45 | - { |
|
46 | - return 'GET'; |
|
47 | - } |
|
37 | + return $apiEndPoint; |
|
38 | + } |
|
39 | + function getPayload() |
|
40 | + { |
|
41 | + return array( |
|
42 | + ); |
|
43 | + } |
|
44 | + function getMethod() |
|
45 | + { |
|
46 | + return 'GET'; |
|
47 | + } |
|
48 | 48 | } |
@@ -7,22 +7,22 @@ |
||
7 | 7 | |
8 | 8 | public $url; |
9 | 9 | |
10 | - function setUrl ($url) |
|
10 | + function setUrl($url) |
|
11 | 11 | { |
12 | 12 | $this->url = $url; |
13 | 13 | } |
14 | 14 | |
15 | - function getUrl () |
|
15 | + function getUrl() |
|
16 | 16 | { |
17 | 17 | return $this->url; |
18 | 18 | } |
19 | 19 | |
20 | - function setLastPostId ($lastPostId) |
|
20 | + function setLastPostId($lastPostId) |
|
21 | 21 | { |
22 | 22 | $this->lastPostId = $lastPostId; |
23 | 23 | } |
24 | 24 | |
25 | - function getlastPostId () |
|
25 | + function getlastPostId() |
|
26 | 26 | { |
27 | 27 | return $this->lastPostId; |
28 | 28 | } |
@@ -3,19 +3,19 @@ |
||
3 | 3 | |
4 | 4 | class Upvote extends AbstractRequest { |
5 | 5 | |
6 | - function getApiEndPoint() |
|
7 | - { |
|
8 | - return '/v2/posts/' . $_GET['postID'] . '/upvote'; |
|
9 | - } |
|
10 | - function getPayload() |
|
11 | - { |
|
12 | - return array( |
|
6 | + function getApiEndPoint() |
|
7 | + { |
|
8 | + return '/v2/posts/' . $_GET['postID'] . '/upvote'; |
|
9 | + } |
|
10 | + function getPayload() |
|
11 | + { |
|
12 | + return array( |
|
13 | 13 | "reason_code" => -1, |
14 | - ); |
|
15 | - } |
|
16 | - function getMethod() |
|
17 | - { |
|
18 | - return 'PUT'; |
|
19 | - } |
|
14 | + ); |
|
15 | + } |
|
16 | + function getMethod() |
|
17 | + { |
|
18 | + return 'PUT'; |
|
19 | + } |
|
20 | 20 | } |
21 | 21 |
@@ -2,19 +2,19 @@ discard block |
||
2 | 2 | |
3 | 3 | abstract class AbstractRequest |
4 | 4 | { |
5 | - CONST CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26'; |
|
6 | - CONST APIURL = 'https://api.go-tellm.com/api'; |
|
7 | - const SECRET = "VwJHzYUbPjGiXWauoVNaHoCWsaacTmnkGwNtHhjy"; |
|
8 | - const USERAGENT = "Jodel/4.27.1 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )"; |
|
9 | - const CLIENT_TYPE = 'android_4.27.1'; |
|
5 | + CONST CLIENTID = '81e8a76e-1e02-4d17-9ba0-8a7020261b26'; |
|
6 | + CONST APIURL = 'https://api.go-tellm.com/api'; |
|
7 | + const SECRET = "VwJHzYUbPjGiXWauoVNaHoCWsaacTmnkGwNtHhjy"; |
|
8 | + const USERAGENT = "Jodel/4.27.1 Dalvik/2.1.0 (Linux; U; Android 5.1.1; )"; |
|
9 | + const CLIENT_TYPE = 'android_4.27.1'; |
|
10 | 10 | |
11 | - /** |
|
12 | - * @var string |
|
13 | - */ |
|
14 | - public $accessToken = null; |
|
15 | - private $payLoad; |
|
16 | - public function execute() |
|
17 | - { |
|
11 | + /** |
|
12 | + * @var string |
|
13 | + */ |
|
14 | + public $accessToken = null; |
|
15 | + private $payLoad; |
|
16 | + public function execute() |
|
17 | + { |
|
18 | 18 | $result = new \stdClass(); |
19 | 19 | |
20 | 20 | $this->payLoad = $this->getPayload(); |
@@ -24,71 +24,71 @@ discard block |
||
24 | 24 | } |
25 | 25 | |
26 | 26 | |
27 | - $this->payLoad = json_encode($this->payLoad); |
|
28 | - $header = $this->getSignHeaders(); |
|
29 | - $url = $this->getFullUrl(); |
|
27 | + $this->payLoad = json_encode($this->payLoad); |
|
28 | + $header = $this->getSignHeaders(); |
|
29 | + $url = $this->getFullUrl(); |
|
30 | 30 | |
31 | - if ($this->getAccessToken()) { |
|
32 | - $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
|
33 | - } |
|
34 | - //Comment out to debug the Request: |
|
35 | - /* |
|
31 | + if ($this->getAccessToken()) { |
|
32 | + $header['Authorization'] = "Bearer " . $this->getAccessToken(); |
|
33 | + } |
|
34 | + //Comment out to debug the Request: |
|
35 | + /* |
|
36 | 36 | var_dump($url); |
37 | 37 | var_dump($header); |
38 | 38 | var_dump($this->payLoad); |
39 | 39 | */ |
40 | 40 | |
41 | 41 | |
42 | - switch ($this->getMethod()) { |
|
43 | - case 'POST': |
|
44 | - $result = Requests::post($url, $header, $this->payLoad); |
|
45 | - break; |
|
46 | - case 'GET': |
|
47 | - $result = Requests::get($url, $header); |
|
48 | - break; |
|
49 | - case 'PUT': |
|
50 | - $result = Requests::put($url, $header, $this->payLoad); |
|
51 | - break; |
|
52 | - } |
|
53 | - switch ($result->status_code) { |
|
54 | - case 200: |
|
55 | - $result = json_decode($result->body, true); |
|
56 | - break; |
|
57 | - case 204: |
|
58 | - $result = "Success"; |
|
59 | - break; |
|
60 | - case 401: |
|
42 | + switch ($this->getMethod()) { |
|
43 | + case 'POST': |
|
44 | + $result = Requests::post($url, $header, $this->payLoad); |
|
45 | + break; |
|
46 | + case 'GET': |
|
47 | + $result = Requests::get($url, $header); |
|
48 | + break; |
|
49 | + case 'PUT': |
|
50 | + $result = Requests::put($url, $header, $this->payLoad); |
|
51 | + break; |
|
52 | + } |
|
53 | + switch ($result->status_code) { |
|
54 | + case 200: |
|
55 | + $result = json_decode($result->body, true); |
|
56 | + break; |
|
57 | + case 204: |
|
58 | + $result = "Success"; |
|
59 | + break; |
|
60 | + case 401: |
|
61 | 61 | throw new \Exception('Unauthorized'); |
62 | - break; |
|
63 | - case 404: |
|
64 | - echo "Es wurde bereits gevoted"; |
|
62 | + break; |
|
63 | + case 404: |
|
64 | + echo "Es wurde bereits gevoted"; |
|
65 | 65 | case 477: |
66 | - echo "Es wurde bereits gevoted"; |
|
67 | - throw new \Exception('Signing failed!'); |
|
68 | - break; |
|
69 | - default: |
|
70 | - throw new \Exception('Unknown Error: '.$result->status_code); |
|
71 | - } |
|
66 | + echo "Es wurde bereits gevoted"; |
|
67 | + throw new \Exception('Signing failed!'); |
|
68 | + break; |
|
69 | + default: |
|
70 | + throw new \Exception('Unknown Error: '.$result->status_code); |
|
71 | + } |
|
72 | 72 | |
73 | - if($device_uid != "") |
|
74 | - { |
|
73 | + if($device_uid != "") |
|
74 | + { |
|
75 | 75 | $result[0] = $result; |
76 | 76 | $result[1] = $device_uid; |
77 | 77 | } |
78 | 78 | |
79 | - /* |
|
79 | + /* |
|
80 | 80 | var_dump($result); |
81 | 81 | */ |
82 | 82 | |
83 | - return $result; |
|
84 | - } |
|
85 | - abstract function getPayload(); |
|
86 | - /** |
|
87 | - * Gets Sign headers |
|
88 | - * @return array headers |
|
89 | - */ |
|
90 | - public function getSignHeaders() |
|
91 | - { |
|
83 | + return $result; |
|
84 | + } |
|
85 | + abstract function getPayload(); |
|
86 | + /** |
|
87 | + * Gets Sign headers |
|
88 | + * @return array headers |
|
89 | + */ |
|
90 | + public function getSignHeaders() |
|
91 | + { |
|
92 | 92 | $payload_accessToken; |
93 | 93 | if($this->getAccessToken() == null) { |
94 | 94 | $payload_accessToken = ""; |
@@ -98,54 +98,54 @@ discard block |
||
98 | 98 | } |
99 | 99 | |
100 | 100 | |
101 | - $headers = array( |
|
102 | - "Connection" => "keep-alive", |
|
103 | - "Accept-Encoding" => "gzip", |
|
104 | - "Content-Type" => "application/json; charset=UTF-8", |
|
105 | - "User-Agent" => self::USERAGENT |
|
106 | - ); |
|
107 | - $timestamp = new DateTime(); |
|
108 | - $timestamp = $timestamp->format(DateTime::ATOM); |
|
109 | - $timestamp = substr($timestamp, 0, -6); |
|
110 | - $timestamp .= "Z"; |
|
111 | - $urlParts = parse_url($this->getFullUrl()); |
|
112 | - $url2 = ""; |
|
113 | - $req = [$this->getMethod(), |
|
114 | - $urlParts['host'], |
|
115 | - "443", |
|
116 | - $urlParts['path'], |
|
117 | - $payload_accessToken, |
|
118 | - $timestamp, |
|
119 | - $url2, |
|
120 | - $this->payLoad]; |
|
121 | - $reqString = implode("%", $req); |
|
122 | - $secret = self::SECRET; |
|
123 | - $signature = hash_hmac('sha1', $reqString, $secret); |
|
124 | - $signature = strtoupper($signature); |
|
125 | - $headers['X-Authorization'] = 'HMAC ' . $signature; |
|
126 | - $headers['X-Client-Type'] = self::CLIENT_TYPE; |
|
127 | - $headers['X-Timestamp'] = $timestamp; |
|
128 | - $headers['X-Api-Version'] = '0.2'; |
|
129 | - return $headers; |
|
130 | - } |
|
131 | - public function getFullUrl() |
|
132 | - { |
|
133 | - return self::APIURL . $this->getApiEndPoint(); |
|
134 | - } |
|
135 | - abstract function getApiEndPoint(); |
|
136 | - abstract function getMethod(); |
|
137 | - /** |
|
138 | - * @return string |
|
139 | - */ |
|
140 | - public function getAccessToken() |
|
141 | - { |
|
142 | - return $this->accessToken; |
|
143 | - } |
|
144 | - /** |
|
145 | - * @param string $accessToken |
|
146 | - */ |
|
147 | - public function setAccessToken(string $accessToken) |
|
148 | - { |
|
149 | - $this->accessToken = $accessToken; |
|
150 | - } |
|
101 | + $headers = array( |
|
102 | + "Connection" => "keep-alive", |
|
103 | + "Accept-Encoding" => "gzip", |
|
104 | + "Content-Type" => "application/json; charset=UTF-8", |
|
105 | + "User-Agent" => self::USERAGENT |
|
106 | + ); |
|
107 | + $timestamp = new DateTime(); |
|
108 | + $timestamp = $timestamp->format(DateTime::ATOM); |
|
109 | + $timestamp = substr($timestamp, 0, -6); |
|
110 | + $timestamp .= "Z"; |
|
111 | + $urlParts = parse_url($this->getFullUrl()); |
|
112 | + $url2 = ""; |
|
113 | + $req = [$this->getMethod(), |
|
114 | + $urlParts['host'], |
|
115 | + "443", |
|
116 | + $urlParts['path'], |
|
117 | + $payload_accessToken, |
|
118 | + $timestamp, |
|
119 | + $url2, |
|
120 | + $this->payLoad]; |
|
121 | + $reqString = implode("%", $req); |
|
122 | + $secret = self::SECRET; |
|
123 | + $signature = hash_hmac('sha1', $reqString, $secret); |
|
124 | + $signature = strtoupper($signature); |
|
125 | + $headers['X-Authorization'] = 'HMAC ' . $signature; |
|
126 | + $headers['X-Client-Type'] = self::CLIENT_TYPE; |
|
127 | + $headers['X-Timestamp'] = $timestamp; |
|
128 | + $headers['X-Api-Version'] = '0.2'; |
|
129 | + return $headers; |
|
130 | + } |
|
131 | + public function getFullUrl() |
|
132 | + { |
|
133 | + return self::APIURL . $this->getApiEndPoint(); |
|
134 | + } |
|
135 | + abstract function getApiEndPoint(); |
|
136 | + abstract function getMethod(); |
|
137 | + /** |
|
138 | + * @return string |
|
139 | + */ |
|
140 | + public function getAccessToken() |
|
141 | + { |
|
142 | + return $this->accessToken; |
|
143 | + } |
|
144 | + /** |
|
145 | + * @param string $accessToken |
|
146 | + */ |
|
147 | + public function setAccessToken(string $accessToken) |
|
148 | + { |
|
149 | + $this->accessToken = $accessToken; |
|
150 | + } |
|
151 | 151 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | $this->payLoad = $this->getPayload(); |
21 | 21 | $device_uid = ""; |
22 | - if(isset($this->payLoad["device_uid"])) { |
|
22 | + if (isset($this->payLoad["device_uid"])) { |
|
23 | 23 | $device_uid = $this->payLoad["device_uid"]; |
24 | 24 | } |
25 | 25 | |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | throw new \Exception('Signing failed!'); |
68 | 68 | break; |
69 | 69 | default: |
70 | - throw new \Exception('Unknown Error: '.$result->status_code); |
|
70 | + throw new \Exception('Unknown Error: ' . $result->status_code); |
|
71 | 71 | } |
72 | 72 | |
73 | - if($device_uid != "") |
|
73 | + if ($device_uid != "") |
|
74 | 74 | { |
75 | 75 | $result[0] = $result; |
76 | 76 | $result[1] = $device_uid; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | public function getSignHeaders() |
91 | 91 | { |
92 | 92 | $payload_accessToken; |
93 | - if($this->getAccessToken() == null) { |
|
93 | + if ($this->getAccessToken() == null) { |
|
94 | 94 | $payload_accessToken = ""; |
95 | 95 | } |
96 | 96 | else { |
@@ -92,8 +92,7 @@ |
||
92 | 92 | $payload_accessToken; |
93 | 93 | if($this->getAccessToken() == null) { |
94 | 94 | $payload_accessToken = ""; |
95 | - } |
|
96 | - else { |
|
95 | + } else { |
|
97 | 96 | $payload_accessToken = $this->getAccessToken(); |
98 | 97 | } |
99 | 98 |
@@ -162,7 +162,7 @@ |
||
162 | 162 | * |
163 | 163 | * @var Requests_Response $response |
164 | 164 | */ |
165 | - public function before_redirect_check(Requests_Response &$return) { |
|
165 | + public function before_redirect_check(Requests_Response&$return) { |
|
166 | 166 | $url = $return->url; |
167 | 167 | if (!$url instanceof Requests_IRI) { |
168 | 168 | $url = new Requests_IRI($url); |
@@ -29,5 +29,5 @@ |
||
29 | 29 | * @see Requests_Hooks::register |
30 | 30 | * @param Requests_Hooks $hooks Hook system |
31 | 31 | */ |
32 | - public function register(Requests_Hooks &$hooks); |
|
32 | + public function register(Requests_Hooks&$hooks); |
|
33 | 33 | } |
34 | 34 | \ No newline at end of file |
@@ -82,7 +82,7 @@ |
||
82 | 82 | * @see fsockopen_header |
83 | 83 | * @param Requests_Hooks $hooks Hook system |
84 | 84 | */ |
85 | - public function register(Requests_Hooks &$hooks) { |
|
85 | + public function register(Requests_Hooks&$hooks) { |
|
86 | 86 | $hooks->register('curl.before_send', array(&$this, 'curl_before_send')); |
87 | 87 | |
88 | 88 | $hooks->register('fsockopen.remote_socket', array(&$this, 'fsockopen_remote_socket')); |
@@ -57,16 +57,13 @@ |
||
57 | 57 | public function __construct($args = null) { |
58 | 58 | if (is_string($args)) { |
59 | 59 | $this->proxy = $args; |
60 | - } |
|
61 | - elseif (is_array($args)) { |
|
60 | + } elseif (is_array($args)) { |
|
62 | 61 | if (count($args) == 1) { |
63 | 62 | list($this->proxy) = $args; |
64 | - } |
|
65 | - elseif (count($args) == 3) { |
|
63 | + } elseif (count($args) == 3) { |
|
66 | 64 | list($this->proxy, $this->user, $this->pass) = $args; |
67 | 65 | $this->use_authentication = true; |
68 | - } |
|
69 | - else { |
|
66 | + } else { |
|
70 | 67 | throw new Requests_Exception('Invalid number of arguments', 'proxyhttpbadargs'); |
71 | 68 | } |
72 | 69 | } |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | curl_setopt($this->handle, CURLOPT_ENCODING, ''); |
101 | 101 | } |
102 | 102 | if (defined('CURLOPT_PROTOCOLS')) { |
103 | - curl_setopt($this->handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); |
|
103 | + curl_setopt($this->handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS); |
|
104 | 104 | } |
105 | 105 | if (defined('CURLOPT_REDIR_PROTOCOLS')) { |
106 | - curl_setopt($this->handle, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); |
|
106 | + curl_setopt($this->handle, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS); |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $options['hooks']->dispatch('curl.before_request', array(&$this->handle)); |
311 | 311 | |
312 | 312 | // Force closing the connection for old versions of cURL (<7.22). |
313 | - if ( ! isset( $headers['Connection'] ) ) { |
|
313 | + if (!isset($headers['Connection'])) { |
|
314 | 314 | $headers['Connection'] = 'close'; |
315 | 315 | } |
316 | 316 | |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | // If needed, check that our installed curl version supports SSL |
533 | 533 | if (isset($capabilities['ssl']) && $capabilities['ssl']) { |
534 | 534 | $curl_version = curl_version(); |
535 | - if (!(CURL_VERSION_SSL & $curl_version['features'])) { |
|
535 | + if (!(CURL_VERSION_SSL&$curl_version['features'])) { |
|
536 | 536 | return false; |
537 | 537 | } |
538 | 538 | } |
@@ -149,8 +149,7 @@ discard block |
||
149 | 149 | if ($options['verify'] === false) { |
150 | 150 | curl_setopt($this->handle, CURLOPT_SSL_VERIFYHOST, 0); |
151 | 151 | curl_setopt($this->handle, CURLOPT_SSL_VERIFYPEER, 0); |
152 | - } |
|
153 | - elseif (is_string($options['verify'])) { |
|
152 | + } elseif (is_string($options['verify'])) { |
|
154 | 153 | curl_setopt($this->handle, CURLOPT_CAINFO, $options['verify']); |
155 | 154 | } |
156 | 155 | } |
@@ -246,8 +245,7 @@ discard block |
||
246 | 245 | ); |
247 | 246 | $responses[$key] = $exception; |
248 | 247 | $options['hooks']->dispatch('transport.internal.parse_error', array(&$responses[$key], $requests[$key])); |
249 | - } |
|
250 | - else { |
|
248 | + } else { |
|
251 | 249 | $responses[$key] = $subrequests[$key]->process_response($subrequests[$key]->response_data, $options); |
252 | 250 | |
253 | 251 | $options['hooks']->dispatch('transport.internal.parse_response', array(&$responses[$key], $requests[$key])); |
@@ -322,8 +320,7 @@ discard block |
||
322 | 320 | if ($data_format === 'query') { |
323 | 321 | $url = self::format_get($url, $data); |
324 | 322 | $data = ''; |
325 | - } |
|
326 | - elseif (!is_string($data)) { |
|
323 | + } elseif (!is_string($data)) { |
|
327 | 324 | $data = http_build_query($data, null, '&'); |
328 | 325 | } |
329 | 326 | } |
@@ -361,15 +358,13 @@ discard block |
||
361 | 358 | |
362 | 359 | if (is_int($timeout) || $this->version < self::CURL_7_16_2) { |
363 | 360 | curl_setopt($this->handle, CURLOPT_TIMEOUT, ceil($timeout)); |
364 | - } |
|
365 | - else { |
|
361 | + } else { |
|
366 | 362 | curl_setopt($this->handle, CURLOPT_TIMEOUT_MS, round($timeout * 1000)); |
367 | 363 | } |
368 | 364 | |
369 | 365 | if (is_int($options['connect_timeout']) || $this->version < self::CURL_7_16_2) { |
370 | 366 | curl_setopt($this->handle, CURLOPT_CONNECTTIMEOUT, ceil($options['connect_timeout'])); |
371 | - } |
|
372 | - else { |
|
367 | + } else { |
|
373 | 368 | curl_setopt($this->handle, CURLOPT_CONNECTTIMEOUT_MS, round($options['connect_timeout'] * 1000)); |
374 | 369 | } |
375 | 370 | curl_setopt($this->handle, CURLOPT_URL, $url); |
@@ -380,8 +375,7 @@ discard block |
||
380 | 375 | } |
381 | 376 | if ($options['protocol_version'] === 1.1) { |
382 | 377 | curl_setopt($this->handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); |
383 | - } |
|
384 | - else { |
|
378 | + } else { |
|
385 | 379 | curl_setopt($this->handle, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); |
386 | 380 | } |
387 | 381 | |
@@ -408,8 +402,7 @@ discard block |
||
408 | 402 | if ($options['filename'] !== false) { |
409 | 403 | fclose($this->stream_handle); |
410 | 404 | $this->headers = trim($this->headers); |
411 | - } |
|
412 | - else { |
|
405 | + } else { |
|
413 | 406 | $this->headers .= $response; |
414 | 407 | } |
415 | 408 | |
@@ -479,8 +472,7 @@ discard block |
||
479 | 472 | |
480 | 473 | if ($this->stream_handle) { |
481 | 474 | fwrite($this->stream_handle, $data); |
482 | - } |
|
483 | - else { |
|
475 | + } else { |
|
484 | 476 | $this->response_data .= $data; |
485 | 477 | } |
486 | 478 | |
@@ -500,8 +492,7 @@ discard block |
||
500 | 492 | $url_parts = parse_url($url); |
501 | 493 | if (empty($url_parts['query'])) { |
502 | 494 | $query = $url_parts['query'] = ''; |
503 | - } |
|
504 | - else { |
|
495 | + } else { |
|
505 | 496 | $query = $url_parts['query']; |
506 | 497 | } |
507 | 498 | |
@@ -510,8 +501,7 @@ discard block |
||
510 | 501 | |
511 | 502 | if (empty($url_parts['query'])) { |
512 | 503 | $url .= '?' . $query; |
513 | - } |
|
514 | - else { |
|
504 | + } else { |
|
515 | 505 | $url = str_replace($url_parts['query'], $query, $url); |
516 | 506 | } |
517 | 507 | } |