@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php |
2 | 2 | //Nothing to see here |
3 | 3 | |
4 | -header( 'HTTP/1.0 403 Forbidden' ); |
|
5 | 4 | \ No newline at end of file |
5 | +header('HTTP/1.0 403 Forbidden'); |
|
6 | 6 | \ No newline at end of file |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php |
2 | 2 | //Nothing to see here |
3 | 3 | |
4 | -header( 'HTTP/1.0 403 Forbidden' ); |
|
5 | 4 | \ No newline at end of file |
5 | +header('HTTP/1.0 403 Forbidden'); |
|
6 | 6 | \ No newline at end of file |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php |
2 | 2 | //Nothing to see here |
3 | 3 | |
4 | -header( 'HTTP/1.0 403 Forbidden' ); |
|
5 | 4 | \ No newline at end of file |
5 | +header('HTTP/1.0 403 Forbidden'); |
|
6 | 6 | \ No newline at end of file |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php |
2 | 2 | //Nothing to see here |
3 | 3 | |
4 | -header( 'HTTP/1.0 403 Forbidden' ); |
|
5 | 4 | \ No newline at end of file |
5 | +header('HTTP/1.0 403 Forbidden'); |
|
6 | 6 | \ No newline at end of file |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * limitations under the License. |
16 | 16 | */ |
17 | 17 | |
18 | -if (!class_exists('MonsterInsights_GA_Lib_Client')) { |
|
18 | +if ( ! class_exists('MonsterInsights_GA_Lib_Client')) { |
|
19 | 19 | require_once dirname(__FILE__) . '/../autoload.php'; |
20 | 20 | } |
21 | 21 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $decoded = json_decode($body, true); |
81 | 81 | $err = 'Error calling ' . $response->getRequestMethod() . ' ' . $response->getUrl(); |
82 | 82 | if (isset($decoded['error']) && |
83 | - isset($decoded['error']['message']) && |
|
83 | + isset($decoded['error']['message']) && |
|
84 | 84 | isset($decoded['error']['code'])) { |
85 | 85 | // if we're getting a json encoded error definition, use that instead of the raw response |
86 | 86 | // body for improved readability |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * limitations under the License. |
16 | 16 | */ |
17 | 17 | |
18 | -if (!class_exists('MonsterInsights_GA_Lib_Client')) { |
|
18 | +if ( ! class_exists('MonsterInsights_GA_Lib_Client')) { |
|
19 | 19 | require_once dirname(__FILE__) . '/../autoload.php'; |
20 | 20 | } |
21 | 21 | |
@@ -257,8 +257,7 @@ discard block |
||
257 | 257 | { |
258 | 258 | return $this->baseComponent . $this->path . |
259 | 259 | (count($this->queryParams) ? |
260 | - "?" . $this->buildQuery($this->queryParams) : |
|
261 | - ''); |
|
260 | + "?" . $this->buildQuery($this->queryParams) : ''); |
|
262 | 261 | } |
263 | 262 | |
264 | 263 | /** |
@@ -452,7 +451,7 @@ discard block |
||
452 | 451 | list($key, $value) = explode('=', $part, 2); |
453 | 452 | $value = urldecode($value); |
454 | 453 | if (isset($return[$key])) { |
455 | - if (!is_array($return[$key])) { |
|
454 | + if ( ! is_array($return[$key])) { |
|
456 | 455 | $return[$key] = array($return[$key]); |
457 | 456 | } |
458 | 457 | $return[$key][] = $value; |
@@ -126,14 +126,14 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | /** |
129 | - * Sends a PUT-Request to google drive and parses the response, |
|
130 | - * setting the appropiate variables from the response() |
|
131 | - * |
|
132 | - * @param MonsterInsights_GA_Lib_Http_Request $httpRequest the Reuqest which will be send |
|
133 | - * |
|
134 | - * @return false|mixed false when the upload is unfinished or the decoded http response |
|
135 | - * |
|
136 | - */ |
|
129 | + * Sends a PUT-Request to google drive and parses the response, |
|
130 | + * setting the appropiate variables from the response() |
|
131 | + * |
|
132 | + * @param MonsterInsights_GA_Lib_Http_Request $httpRequest the Reuqest which will be send |
|
133 | + * |
|
134 | + * @return false|mixed false when the upload is unfinished or the decoded http response |
|
135 | + * |
|
136 | + */ |
|
137 | 137 | private function makePutRequest(MonsterInsights_GA_Lib_Http_Request $httpRequest) |
138 | 138 | { |
139 | 139 | if ($this->client->getClassConfig("MonsterInsights_GA_Lib_Http_Request", "enable_gzip_for_uploads")) { |
@@ -202,17 +202,17 @@ discard block |
||
202 | 202 | */ |
203 | 203 | public function resume($resumeUri) |
204 | 204 | { |
205 | - $this->resumeUri = $resumeUri; |
|
206 | - $headers = array( |
|
207 | - 'content-range' => "bytes */$this->size", |
|
208 | - 'content-length' => 0, |
|
209 | - ); |
|
210 | - $httpRequest = new MonsterInsights_GA_Lib_Http_Request( |
|
211 | - $this->resumeUri, |
|
212 | - 'PUT', |
|
213 | - $headers |
|
214 | - ); |
|
215 | - return $this->makePutRequest($httpRequest); |
|
205 | + $this->resumeUri = $resumeUri; |
|
206 | + $headers = array( |
|
207 | + 'content-range' => "bytes */$this->size", |
|
208 | + 'content-length' => 0, |
|
209 | + ); |
|
210 | + $httpRequest = new MonsterInsights_GA_Lib_Http_Request( |
|
211 | + $this->resumeUri, |
|
212 | + 'PUT', |
|
213 | + $headers |
|
214 | + ); |
|
215 | + return $this->makePutRequest($httpRequest); |
|
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * limitations under the License. |
16 | 16 | */ |
17 | 17 | |
18 | -if (!class_exists('MonsterInsights_GA_Lib_Client')) { |
|
18 | +if ( ! class_exists('MonsterInsights_GA_Lib_Client')) { |
|
19 | 19 | require_once dirname(__FILE__) . '/../autoload.php'; |
20 | 20 | } |
21 | 21 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $this->data = $data; |
88 | 88 | $this->size = strlen($this->data); |
89 | 89 | $this->resumable = $resumable; |
90 | - if (!$chunkSize) { |
|
90 | + if ( ! $chunkSize) { |
|
91 | 91 | $chunkSize = 256 * 1024; |
92 | 92 | } |
93 | 93 | $this->chunkSize = $chunkSize; |
@@ -231,8 +231,7 @@ discard block |
||
231 | 231 | $this->request->setQueryParam('uploadType', $uploadType); |
232 | 232 | $this->transformToUploadUrl(); |
233 | 233 | $mimeType = $this->mimeType ? |
234 | - $this->mimeType : |
|
235 | - $this->request->getRequestHeader('content-type'); |
|
234 | + $this->mimeType : $this->request->getRequestHeader('content-type'); |
|
236 | 235 | |
237 | 236 | if (self::UPLOAD_RESUMABLE_TYPE == $uploadType) { |
238 | 237 | $contentType = $mimeType; |
@@ -294,7 +293,7 @@ discard block |
||
294 | 293 | |
295 | 294 | public function getResumeUri() |
296 | 295 | { |
297 | - return ( $this->resumeUri !== null ? $this->resumeUri : $this->fetchResumeUri() ); |
|
296 | + return ($this->resumeUri !== null ? $this->resumeUri : $this->fetchResumeUri()); |
|
298 | 297 | } |
299 | 298 | |
300 | 299 | private function fetchResumeUri() |
@@ -321,7 +320,7 @@ discard block |
||
321 | 320 | } |
322 | 321 | $message = $code; |
323 | 322 | $body = @json_decode($response->getResponseBody()); |
324 | - if (!empty($body->error->errors) ) { |
|
323 | + if ( ! empty($body->error->errors)) { |
|
325 | 324 | $message .= ': '; |
326 | 325 | foreach ($body->error->errors as $error) { |
327 | 326 | $message .= "{$error->domain}, {$error->message};"; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * limitations under the License. |
16 | 16 | */ |
17 | 17 | |
18 | -if (!class_exists('MonsterInsights_GA_Lib_Client')) { |
|
18 | +if ( ! class_exists('MonsterInsights_GA_Lib_Client')) { |
|
19 | 19 | require_once dirname(__FILE__) . '/../autoload.php'; |
20 | 20 | } |
21 | 21 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | public static function isRequestCacheable(MonsterInsights_GA_Lib_Http_Request $resp) |
40 | 40 | { |
41 | 41 | $method = $resp->getRequestMethod(); |
42 | - if (! in_array($method, self::$CACHEABLE_HTTP_METHODS)) { |
|
42 | + if ( ! in_array($method, self::$CACHEABLE_HTTP_METHODS)) { |
|
43 | 43 | return false; |
44 | 44 | } |
45 | 45 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | $code = $resp->getResponseHttpCode(); |
74 | - if (! in_array($code, self::$CACHEABLE_STATUS_CODES)) { |
|
74 | + if ( ! in_array($code, self::$CACHEABLE_STATUS_CODES)) { |
|
75 | 75 | return false; |
76 | 76 | } |
77 | 77 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * limitations under the License. |
16 | 16 | */ |
17 | 17 | |
18 | -if (!class_exists('MonsterInsights_GA_Lib_Client')) { |
|
18 | +if ( ! class_exists('MonsterInsights_GA_Lib_Client')) { |
|
19 | 19 | require_once dirname(__FILE__) . '/../autoload.php'; |
20 | 20 | } |
21 | 21 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | foreach ($parts as $part) { |
105 | 105 | $part = trim($part); |
106 | - if (!empty($part)) { |
|
106 | + if ( ! empty($part)) { |
|
107 | 107 | list($metaHeaders, $part) = explode("\r\n\r\n", $part, 2); |
108 | 108 | $metaHeaders = $this->client->getIo()->getHttpResponseHeaders($metaHeaders); |
109 | 109 |