@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | public function __construct() |
| 41 | 41 | { |
| 42 | 42 | if (!function_exists('openssl_random_pseudo_bytes')) { |
| 43 | - throw new FacebookSDKException(static::ERROR_MESSAGE . 'The function openssl_random_pseudo_bytes() does not exist.'); |
|
| 43 | + throw new FacebookSDKException(static::ERROR_MESSAGE.'The function openssl_random_pseudo_bytes() does not exist.'); |
|
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |
@@ -55,11 +55,11 @@ discard block |
||
| 55 | 55 | $binaryString = openssl_random_pseudo_bytes($length, $wasCryptographicallyStrong); |
| 56 | 56 | |
| 57 | 57 | if ($binaryString === false) { |
| 58 | - throw new FacebookSDKException(static::ERROR_MESSAGE . 'openssl_random_pseudo_bytes() returned an unknown error.'); |
|
| 58 | + throw new FacebookSDKException(static::ERROR_MESSAGE.'openssl_random_pseudo_bytes() returned an unknown error.'); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | if ($wasCryptographicallyStrong !== true) { |
| 62 | - throw new FacebookSDKException(static::ERROR_MESSAGE . 'openssl_random_pseudo_bytes() returned a pseudo-random string but it was not cryptographically secure and cannot be used.'); |
|
| 62 | + throw new FacebookSDKException(static::ERROR_MESSAGE.'openssl_random_pseudo_bytes() returned a pseudo-random string but it was not cryptographically secure and cannot be used.'); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | return $this->binToHex($binaryString, $length); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | { |
| 42 | 42 | if (!function_exists('mcrypt_create_iv')) { |
| 43 | 43 | throw new FacebookSDKException( |
| 44 | - static::ERROR_MESSAGE . |
|
| 44 | + static::ERROR_MESSAGE. |
|
| 45 | 45 | 'The function mcrypt_create_iv() does not exist.' |
| 46 | 46 | ); |
| 47 | 47 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | if ($binaryString === false) { |
| 60 | 60 | throw new FacebookSDKException( |
| 61 | - static::ERROR_MESSAGE . |
|
| 61 | + static::ERROR_MESSAGE. |
|
| 62 | 62 | 'mcrypt_create_iv() returned an error.' |
| 63 | 63 | ); |
| 64 | 64 | } |
@@ -42,14 +42,14 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | if (ini_get('open_basedir')) { |
| 44 | 44 | throw new FacebookSDKException( |
| 45 | - static::ERROR_MESSAGE . |
|
| 45 | + static::ERROR_MESSAGE. |
|
| 46 | 46 | 'There is an open_basedir constraint that prevents access to /dev/urandom.' |
| 47 | 47 | ); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | if (!is_readable('/dev/urandom')) { |
| 51 | 51 | throw new FacebookSDKException( |
| 52 | - static::ERROR_MESSAGE . |
|
| 52 | + static::ERROR_MESSAGE. |
|
| 53 | 53 | 'Unable to read from /dev/urandom.' |
| 54 | 54 | ); |
| 55 | 55 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $stream = fopen('/dev/urandom', 'rb'); |
| 66 | 66 | if (!is_resource($stream)) { |
| 67 | 67 | throw new FacebookSDKException( |
| 68 | - static::ERROR_MESSAGE . |
|
| 68 | + static::ERROR_MESSAGE. |
|
| 69 | 69 | 'Unable to open stream to /dev/urandom.' |
| 70 | 70 | ); |
| 71 | 71 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | if (!$binaryString) { |
| 81 | 81 | throw new FacebookSDKException( |
| 82 | - static::ERROR_MESSAGE . |
|
| 82 | + static::ERROR_MESSAGE. |
|
| 83 | 83 | 'Stream to /dev/urandom returned no data.' |
| 84 | 84 | ); |
| 85 | 85 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function makeGraphAchievement() |
| 106 | 106 | { |
| 107 | - return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphAchievement'); |
|
| 107 | + return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX.'GraphAchievement'); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | /** |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | */ |
| 117 | 117 | public function makeGraphAlbum() |
| 118 | 118 | { |
| 119 | - return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphAlbum'); |
|
| 119 | + return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX.'GraphAlbum'); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public function makeGraphPage() |
| 130 | 130 | { |
| 131 | - return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphPage'); |
|
| 131 | + return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX.'GraphPage'); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | public function makeGraphSessionInfo() |
| 142 | 142 | { |
| 143 | - return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphSessionInfo'); |
|
| 143 | + return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX.'GraphSessionInfo'); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | */ |
| 153 | 153 | public function makeGraphUser() |
| 154 | 154 | { |
| 155 | - return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphUser'); |
|
| 155 | + return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX.'GraphUser'); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | public function makeGraphEvent() |
| 166 | 166 | { |
| 167 | - return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent'); |
|
| 167 | + return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX.'GraphEvent'); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | public function makeGraphGroup() |
| 178 | 178 | { |
| 179 | - return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphGroup'); |
|
| 179 | + return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX.'GraphGroup'); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | /** |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $this->validateResponseCastableAsGraphEdge(); |
| 196 | 196 | |
| 197 | 197 | if ($subclassName && $auto_prefix) { |
| 198 | - $subclassName = static::BASE_GRAPH_OBJECT_PREFIX . $subclassName; |
|
| 198 | + $subclassName = static::BASE_GRAPH_OBJECT_PREFIX.$subclassName; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | return $this->castAsGraphNodeOrGraphEdge($this->decodedBody, $subclassName); |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $metaData = $this->getMetaData($data); |
| 338 | 338 | |
| 339 | 339 | // We'll need to make an edge endpoint for this in case it's a GraphEdge (for cursor pagination) |
| 340 | - $parentGraphEdgeEndpoint = $parentNodeId && $parentKey ? '/' . $parentNodeId . '/' . $parentKey : null; |
|
| 340 | + $parentGraphEdgeEndpoint = $parentNodeId && $parentKey ? '/'.$parentNodeId.'/'.$parentKey : null; |
|
| 341 | 341 | $className = static::BASE_GRAPH_EDGE_CLASS; |
| 342 | 342 | |
| 343 | 343 | return new $className($this->response->getRequest(), $dataList, $metaData, $parentGraphEdgeEndpoint, $subclassName); |
@@ -387,6 +387,6 @@ discard block |
||
| 387 | 387 | return; |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - throw new FacebookSDKException('The given subclass "' . $subclassName . '" is not valid. Cannot cast to an object that is not a GraphNode subclass.', 620); |
|
| 390 | + throw new FacebookSDKException('The given subclass "'.$subclassName.'" is not valid. Cannot cast to an object that is not a GraphNode subclass.', 620); |
|
| 391 | 391 | } |
| 392 | 392 | } |
@@ -68,7 +68,7 @@ |
||
| 68 | 68 | */ |
| 69 | 69 | public function makeGraphEvent() |
| 70 | 70 | { |
| 71 | - return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX . 'GraphEvent'); |
|
| 71 | + return $this->makeGraphNode(static::BASE_GRAPH_OBJECT_PREFIX.'GraphEvent'); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | /** |
@@ -163,13 +163,13 @@ |
||
| 163 | 163 | public function prepareRequestMessage(FacebookRequest $request) |
| 164 | 164 | { |
| 165 | 165 | $postToVideoUrl = $request->containsVideoUploads(); |
| 166 | - $url = $this->getBaseGraphUrl($postToVideoUrl) . $request->getUrl(); |
|
| 166 | + $url = $this->getBaseGraphUrl($postToVideoUrl).$request->getUrl(); |
|
| 167 | 167 | |
| 168 | 168 | // If we're sending files they should be sent as multipart/form-data |
| 169 | 169 | if ($request->containsFileUploads()) { |
| 170 | 170 | $requestBody = $request->getMultipartBody(); |
| 171 | 171 | $request->setHeaders([ |
| 172 | - 'Content-Type' => 'multipart/form-data; boundary=' . $requestBody->getBoundary(), |
|
| 172 | + 'Content-Type' => 'multipart/form-data; boundary='.$requestBody->getBoundary(), |
|
| 173 | 173 | ]); |
| 174 | 174 | } else { |
| 175 | 175 | $requestBody = $request->getUrlEncodedBody(); |
@@ -213,7 +213,7 @@ |
||
| 213 | 213 | /** |
| 214 | 214 | * Returns the exception that was thrown for this request. |
| 215 | 215 | * |
| 216 | - * @return FacebookResponseException|null |
|
| 216 | + * @return FacebookSDKException |
|
| 217 | 217 | */ |
| 218 | 218 | public function getThrownException() |
| 219 | 219 | { |
@@ -328,6 +328,9 @@ discard block |
||
| 328 | 328 | $this->assertEquals($expectedBatchParams, $params); |
| 329 | 329 | } |
| 330 | 330 | |
| 331 | + /** |
|
| 332 | + * @param string $expectedToken |
|
| 333 | + */ |
|
| 331 | 334 | private function assertRequestContainsAppAndToken(FacebookRequest $request, FacebookApp $expectedApp, $expectedToken) |
| 332 | 335 | { |
| 333 | 336 | $app = $request->getApp(); |
@@ -347,6 +350,9 @@ discard block |
||
| 347 | 350 | return $headers; |
| 348 | 351 | } |
| 349 | 352 | |
| 353 | + /** |
|
| 354 | + * @param integer $number |
|
| 355 | + */ |
|
| 350 | 356 | private function createAndAppendRequestsTo(FacebookBatchRequest $batchRequest, $number) |
| 351 | 357 | { |
| 352 | 358 | for ($i = 0; $i < $number; $i++) { |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | [ |
| 225 | 225 | 'headers' => $headers, |
| 226 | 226 | 'method' => 'GET', |
| 227 | - 'relative_url' => '/' . $apiVersion . '/foo?foo=bar&access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9', |
|
| 227 | + 'relative_url' => '/'.$apiVersion.'/foo?foo=bar&access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9', |
|
| 228 | 228 | 'name' => 'foo_name', |
| 229 | 229 | ], |
| 230 | 230 | ], |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | [ |
| 234 | 234 | 'headers' => $headers, |
| 235 | 235 | 'method' => 'POST', |
| 236 | - 'relative_url' => '/' . $apiVersion . '/bar', |
|
| 236 | + 'relative_url' => '/'.$apiVersion.'/bar', |
|
| 237 | 237 | 'body' => 'bar=baz&access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9', |
| 238 | 238 | 'name' => 'foo_name', |
| 239 | 239 | ], |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | [ |
| 244 | 244 | 'headers' => $headers, |
| 245 | 245 | 'method' => 'DELETE', |
| 246 | - 'relative_url' => '/' . $apiVersion . '/bar?access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9', |
|
| 246 | + 'relative_url' => '/'.$apiVersion.'/bar?access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9', |
|
| 247 | 247 | 'name' => 'foo_name', |
| 248 | 248 | ], |
| 249 | 249 | ], |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | { |
| 255 | 255 | $request = new FacebookRequest(null, null, 'POST', '/bar', [ |
| 256 | 256 | 'message' => 'foobar', |
| 257 | - 'source' => new FacebookFile(__DIR__ . '/foo.txt'), |
|
| 257 | + 'source' => new FacebookFile(__DIR__.'/foo.txt'), |
|
| 258 | 258 | ]); |
| 259 | 259 | |
| 260 | 260 | $batchRequest = $this->createBatchRequest(); |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $this->assertEquals([ |
| 274 | 274 | 'headers' => $this->defaultHeaders(), |
| 275 | 275 | 'method' => 'POST', |
| 276 | - 'relative_url' => '/' . Facebook::DEFAULT_GRAPH_VERSION . '/bar', |
|
| 276 | + 'relative_url' => '/'.Facebook::DEFAULT_GRAPH_VERSION.'/bar', |
|
| 277 | 277 | 'body' => 'message=foobar&access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9', |
| 278 | 278 | 'name' => 'foo_name', |
| 279 | 279 | 'attached_files' => $attachedFiles, |
@@ -292,8 +292,8 @@ discard block |
||
| 292 | 292 | $expectedHeaders = json_encode($this->defaultHeaders()); |
| 293 | 293 | $version = Facebook::DEFAULT_GRAPH_VERSION; |
| 294 | 294 | $expectedBatchParams = [ |
| 295 | - 'batch' => '[{"headers":' . $expectedHeaders . ',"method":"GET","relative_url":"\\/' . $version . '\\/foo?access_token=bar_token&appsecret_proof=2ceec40b7b9fd7d38fff1767b766bcc6b1f9feb378febac4612c156e6a8354bd","name":"foo_name"},' |
|
| 296 | - . '{"headers":' . $expectedHeaders . ',"method":"POST","relative_url":"\\/' . $version . '\\/bar","body":"foo=bar&access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9"}]', |
|
| 295 | + 'batch' => '[{"headers":'.$expectedHeaders.',"method":"GET","relative_url":"\\/'.$version.'\\/foo?access_token=bar_token&appsecret_proof=2ceec40b7b9fd7d38fff1767b766bcc6b1f9feb378febac4612c156e6a8354bd","name":"foo_name"},' |
|
| 296 | + . '{"headers":'.$expectedHeaders.',"method":"POST","relative_url":"\\/'.$version.'\\/bar","body":"foo=bar&access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9"}]', |
|
| 297 | 297 | 'include_headers' => true, |
| 298 | 298 | 'access_token' => 'foo_token', |
| 299 | 299 | 'appsecret_proof' => 'df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9', |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | $batchRequest->add(new FacebookRequest(null, 'bar_token', 'GET', '/foo'), 'foo_name'); |
| 308 | 308 | $batchRequest->add(new FacebookRequest(null, null, 'POST', '/me/photos', [ |
| 309 | 309 | 'message' => 'foobar', |
| 310 | - 'source' => new FacebookFile(__DIR__ . '/foo.txt'), |
|
| 310 | + 'source' => new FacebookFile(__DIR__.'/foo.txt'), |
|
| 311 | 311 | ])); |
| 312 | 312 | $batchRequest->prepareRequestsForBatch(); |
| 313 | 313 | |
@@ -319,8 +319,8 @@ discard block |
||
| 319 | 319 | $expectedHeaders = json_encode($this->defaultHeaders()); |
| 320 | 320 | $version = Facebook::DEFAULT_GRAPH_VERSION; |
| 321 | 321 | $expectedBatchParams = [ |
| 322 | - 'batch' => '[{"headers":' . $expectedHeaders . ',"method":"GET","relative_url":"\\/' . $version . '\\/foo?access_token=bar_token&appsecret_proof=2ceec40b7b9fd7d38fff1767b766bcc6b1f9feb378febac4612c156e6a8354bd","name":"foo_name"},' |
|
| 323 | - . '{"headers":' . $expectedHeaders . ',"method":"POST","relative_url":"\\/' . $version . '\\/me\\/photos","body":"message=foobar&access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9","attached_files":"' . $attachedFiles . '"}]', |
|
| 322 | + 'batch' => '[{"headers":'.$expectedHeaders.',"method":"GET","relative_url":"\\/'.$version.'\\/foo?access_token=bar_token&appsecret_proof=2ceec40b7b9fd7d38fff1767b766bcc6b1f9feb378febac4612c156e6a8354bd","name":"foo_name"},' |
|
| 323 | + . '{"headers":'.$expectedHeaders.',"method":"POST","relative_url":"\\/'.$version.'\\/me\\/photos","body":"message=foobar&access_token=foo_token&appsecret_proof=df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9","attached_files":"'.$attachedFiles.'"}]', |
|
| 324 | 324 | 'include_headers' => true, |
| 325 | 325 | 'access_token' => 'foo_token', |
| 326 | 326 | 'appsecret_proof' => 'df4256903ba4e23636cc142117aa632133d75c642bd2a68955be1443bd14deb9', |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | { |
| 342 | 342 | $headers = []; |
| 343 | 343 | foreach (FacebookRequest::getDefaultHeaders() as $name => $value) { |
| 344 | - $headers[] = $name . ': ' . $value; |
|
| 344 | + $headers[] = $name.': '.$value; |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | return $headers; |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | { |
| 43 | 43 | $message = new RequestBodyUrlEncoded([ |
| 44 | 44 | 'foo' => 'bar', |
| 45 | - 'faz' => [1,2,3], |
|
| 45 | + 'faz' => [1, 2, 3], |
|
| 46 | 46 | 'targeting' => [ |
| 47 | 47 | 'countries' => 'US,GB', |
| 48 | 48 | 'age_min' => 13, |