Passed
Branch master (1ffcd5)
by Rakesh
07:09 queued 02:15
created
lib/Facebook/Exceptions/FacebookResponseException.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -97,10 +97,10 @@
 block discarded – undo
97 97
                 case 1363037:
98 98
                     $previousException = new FacebookResumableUploadException($message, $code);
99 99
 
100
-                    $startOffset = isset($data['error']['error_data']['start_offset']) ? (int) $data['error']['error_data']['start_offset'] : null;
100
+                    $startOffset = isset($data['error']['error_data']['start_offset']) ? (int)$data['error']['error_data']['start_offset'] : null;
101 101
                     $previousException->setStartOffset($startOffset);
102 102
 
103
-                    $endOffset = isset($data['error']['error_data']['end_offset']) ? (int) $data['error']['error_data']['end_offset'] : null;
103
+                    $endOffset = isset($data['error']['error_data']['end_offset']) ? (int)$data['error']['error_data']['end_offset'] : null;
104 104
                     $previousException->setEndOffset($endOffset);
105 105
 
106 106
                     return new static($response, $previousException);
Please login to merge, or discard this patch.
lib/Facebook/FacebookApp.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@
 block discarded – undo
47 47
     public function __construct($id, $secret)
48 48
     {
49 49
         if (!is_string($id)
50
-          // Keeping this for BC. Integers greater than PHP_INT_MAX will make is_int() return false
50
+            // Keeping this for BC. Integers greater than PHP_INT_MAX will make is_int() return false
51 51
           && !is_int($id)) {
52 52
             throw new FacebookSDKException('The "app_id" must be formatted as a string since many app ID\'s are greater than PHP_INT_MAX on some systems.');
53 53
         }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
             throw new FacebookSDKException('The "app_id" must be formatted as a string since many app ID\'s are greater than PHP_INT_MAX on some systems.');
53 53
         }
54 54
         // We cast as a string in case a valid int was set on a 64-bit system and this is unserialised on a 32-bit system
55
-        $this->id = (string) $id;
55
+        $this->id = (string)$id;
56 56
         $this->secret = $secret;
57 57
     }
58 58
 
Please login to merge, or discard this patch.
lib/Facebook/Facebook.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -602,8 +602,8 @@
 block discarded – undo
602 602
         } while (!$chunk->isLastChunk());
603 603
 
604 604
         return [
605
-          'video_id' => $chunk->getVideoId(),
606
-          'success' => $uploader->finish($endpoint, $chunk->getUploadSessionId(), $metadata),
605
+            'video_id' => $chunk->getVideoId(),
606
+            'success' => $uploader->finish($endpoint, $chunk->getUploadSessionId(), $metadata),
607 607
         ];
608 608
     }
609 609
 
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -593,7 +593,7 @@
 block discarded – undo
593 593
         $graphVersion = $graphVersion ?: $this->defaultGraphVersion;
594 594
 
595 595
         $uploader = new FacebookResumableUploader($this->app, $this->client, $accessToken, $graphVersion);
596
-        $endpoint = '/'.$target.'/videos';
596
+        $endpoint = '/' . $target . '/videos';
597 597
         $file = $this->videoToUpload($pathToFile);
598 598
         $chunk = $uploader->start($endpoint, $file);
599 599
 
Please login to merge, or discard this patch.
lib/Facebook/autoload.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@
 block discarded – undo
44 44
  *
45 45
  * @return void
46 46
  */
47
-spl_autoload_register(function ($class) {
47
+spl_autoload_register(function($class) {
48 48
     // project-specific namespace prefix
49 49
     $prefix = 'Facebook\\';
50 50
 
Please login to merge, or discard this patch.
lib/Facebook/GraphNodes/GraphNode.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@
 block discarded – undo
85 85
     {
86 86
         $items = $this->asArray();
87 87
 
88
-        return array_map(function ($v) {
88
+        return array_map(function($v) {
89 89
             if ($v instanceof \DateTime) {
90 90
                 return $v->format(\DateTime::ISO8601);
91 91
             }
Please login to merge, or discard this patch.
lib/Facebook/GraphNodes/Collection.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@
 block discarded – undo
128 128
      */
129 129
     public function asArray()
130 130
     {
131
-        return array_map(function ($value) {
131
+        return array_map(function($value) {
132 132
             return $value instanceof Collection ? $value->asArray() : $value;
133 133
         }, $this->items);
134 134
     }
Please login to merge, or discard this patch.
lib/Facebook/Http/GraphRawResponse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -106,7 +106,7 @@
 block discarded – undo
106 106
     {
107 107
         // https://tools.ietf.org/html/rfc7230#section-3.1.2
108 108
         list($version, $status, $reason) = array_pad(explode(' ', $rawResponseHeader, 3), 3, null);
109
-        $this->httpResponseCode = (int) $status;
109
+        $this->httpResponseCode = (int)$status;
110 110
     }
111 111
 
112 112
     /**
Please login to merge, or discard this patch.
member.php 2 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if(!session_id()) {
3
-  session_start();
3
+    session_start();
4 4
 }
5 5
 require_once 'lib\Facebook\autoload.php';
6 6
 
7 7
 if(isset($_SESSION['fb_access_token'])){
8
-  // Get access token from session
9
-  $accessToken = $_SESSION['fb_access_token'];
10
-  $user = (array) $_SESSION['user'];
8
+    // Get access token from session
9
+    $accessToken = $_SESSION['fb_access_token'];
10
+    $user = (array) $_SESSION['user'];
11 11
   
12 12
 echo '<br/> User ID: ' . $user['id']; 
13 13
 echo '<br/> Welcome , ' . $user['name'];
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 
74 74
     echo "<div class='item'>";
75 75
     echo "<img src='{$imgSource}' alt=''>";
76
- echo "<p>{$name}</p>";
76
+    echo "<p>{$name}</p>";
77 77
     echo "</div>";
78 78
 }
79 79
 }
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
 
102 102
   <div style="text-align:center">
103 103
   <?php
104
-  if (is_array($fbPhotoData) || is_object($fbPhotoData))
105
-  { 
104
+    if (is_array($fbPhotoData) || is_object($fbPhotoData))
105
+    { 
106 106
     foreach($fbPhotoData as $data){
107
-      echo "<span class='dot'></span>";
108
-   }
109
-  }
110
-  ?>
107
+        echo "<span class='dot'></span>";
108
+    }
109
+    }
110
+    ?>
111 111
   </div>
112 112
 
113 113
 </div>
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!session_id()) {
2
+if (!session_id()) {
3 3
   session_start();
4 4
 }
5 5
 require_once 'lib\Facebook\autoload.php';
6 6
 
7
-if(isset($_SESSION['fb_access_token'])){
7
+if (isset($_SESSION['fb_access_token'])) {
8 8
   // Get access token from session
9 9
   $accessToken = $_SESSION['fb_access_token'];
10
-  $user = (array) $_SESSION['user'];
10
+  $user = (array)$_SESSION['user'];
11 11
   
12 12
 echo '<br/> User ID: ' . $user['id']; 
13 13
 echo '<br/> Welcome , ' . $user['name'];
@@ -26,32 +26,32 @@  discard block
 block discarded – undo
26 26
 
27 27
 // Render all photo albums
28 28
 echo "<br/><br/>";
29
-foreach($fbAlbumData as $data){
30
-    $id = isset($data['id'])?$data['id']:'';
31
-    $name = isset($data['name'])?$data['name']:'';
32
-    $description = isset($data['description'])?$data['description']:'';
33
-    $link = isset($data['link'])?$data['link']:'';
34
-    $cover_photo_id = isset($data['cover_photo']['id'])?$data['cover_photo']['id']:'';
35
-    $count = isset($data['count'])?$data['count']:'';
29
+foreach ($fbAlbumData as $data) {
30
+    $id = isset($data['id']) ? $data['id'] : '';
31
+    $name = isset($data['name']) ? $data['name'] : '';
32
+    $description = isset($data['description']) ? $data['description'] : '';
33
+    $link = isset($data['link']) ? $data['link'] : '';
34
+    $cover_photo_id = isset($data['cover_photo']['id']) ? $data['cover_photo']['id'] : '';
35
+    $count = isset($data['count']) ? $data['count'] : '';
36 36
     
37 37
     $pictureLink = "fb-callback.php?album_id={$id}&album_name={$name}";
38 38
     
39 39
 
40 40
     echo "<a href='{$pictureLink}'>";
41
-    $cover_photo_id = (!empty($cover_photo_id ))?$cover_photo_id : 123456;
41
+    $cover_photo_id = (!empty($cover_photo_id)) ? $cover_photo_id : 123456;
42 42
     echo "<img width=100px height=100px src='https://graph.facebook.com/v3.2/{$cover_photo_id}/picture?access_token={$accessToken}' alt=''>";
43 43
     echo "</a>";
44 44
     echo "<p>{$name}</p>";
45 45
 
46
-    $photoCount = ($count > 1)?$count. 'Photos':$count. 'Photo';
46
+    $photoCount = ($count > 1) ? $count . 'Photos' : $count . 'Photo';
47 47
     
48 48
     echo "<p><span style='color:#888;'>{$photoCount} / <a href='{$link}' target='_blank'>View on Facebook</a></span></p>";
49 49
     echo "<p>{$description}</p>";
50 50
 }
51 51
 //}
52 52
 
53
-$album_id = isset($_GET['album_id'])?$_GET['album_id']:header('Location: fb-callback.php');
54
-$album_name = isset($_GET['album_name'])?$_GET['album_name']:header('Location: fb-callback.php');
53
+$album_id = isset($_GET['album_id']) ? $_GET['album_id'] : header('Location: fb-callback.php');
54
+$album_name = isset($_GET['album_name']) ? $_GET['album_name'] : header('Location: fb-callback.php');
55 55
 
56 56
 // Get photos of Facebook page album using Facebook Graph API
57 57
 $graphPhoLink = "https://graph.facebook.com/v3.2/{$album_id}/photos?fields=source,images,name&access_token={$accessToken}";
@@ -61,15 +61,15 @@  discard block
 block discarded – undo
61 61
 // Facebook photos content
62 62
 $fbPhotoData = $fbPhotoObj['data'];
63 63
 
64
-echo "<h2>".$album_name."</h2>";
64
+echo "<h2>" . $album_name . "</h2>";
65 65
 
66 66
 // Render all photos   
67 67
 if (is_array($fbPhotoData) || is_object($fbPhotoData))
68 68
 {  
69
-foreach($fbPhotoData as $data){
69
+foreach ($fbPhotoData as $data) {
70 70
     $imageData = end($data['images']);
71
-    $imgSource = isset($imageData['source'])?$imageData['source']:'';
72
-    $name = isset($data['name'])?$data['name']:'';
71
+    $imgSource = isset($imageData['source']) ? $imageData['source'] : '';
72
+    $name = isset($data['name']) ? $data['name'] : '';
73 73
 
74 74
     echo "<div class='item'>";
75 75
     echo "<img src='{$imgSource}' alt=''>";
@@ -85,10 +85,10 @@  discard block
 block discarded – undo
85 85
 // Render all photos 
86 86
 if (is_array($fbPhotoData) || is_object($fbPhotoData))
87 87
 {   
88
-foreach($fbPhotoData as $data){
88
+foreach ($fbPhotoData as $data) {
89 89
     $imageData = end($data['images']);
90
-    $imgSource = isset($imageData['source'])?$imageData['source']:'';
91
-    $name = isset($data['name'])?$data['name']:'';
90
+    $imgSource = isset($imageData['source']) ? $imageData['source'] : '';
91
+    $name = isset($data['name']) ? $data['name'] : '';
92 92
 
93 93
 echo "<div class='mySlides fade'>";
94 94
 echo "<img src='{$imgSource}' alt='' style='width:100%'>";
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
   <?php
104 104
   if (is_array($fbPhotoData) || is_object($fbPhotoData))
105 105
   { 
106
-    foreach($fbPhotoData as $data){
106
+    foreach ($fbPhotoData as $data) {
107 107
       echo "<span class='dot'></span>";
108 108
    }
109 109
   }
Please login to merge, or discard this patch.
fb-callback.php 3 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,50 +1,50 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if(!session_id()) {
3
-  session_start();
3
+    session_start();
4 4
 }
5 5
 require_once 'lib\Facebook\autoload.php';
6 6
 
7 7
 if(isset($_SESSION['fb_access_token'])){
8
-  // Get access token from session
9
-  $accessToken = $_SESSION['fb_access_token'];
10
-  //header('location:member.php');
8
+    // Get access token from session
9
+    $accessToken = $_SESSION['fb_access_token'];
10
+    //header('location:member.php');
11 11
 }else{
12
-  $appId='362540437809242';
13
-  $appSecret='538cd04f971479ff14dc409df2fbcf3b';
12
+    $appId='362540437809242';
13
+    $appSecret='538cd04f971479ff14dc409df2fbcf3b';
14 14
 
15 15
 $fb = new Facebook\Facebook([
16
-  'app_id' => $appId, // variable with My Facebook App ID
17
-  'app_secret' => $appSecret,
18
-  'default_graph_version' => 'v3.2',
19
-  ]);
16
+    'app_id' => $appId, // variable with My Facebook App ID
17
+    'app_secret' => $appSecret,
18
+    'default_graph_version' => 'v3.2',
19
+    ]);
20 20
 
21 21
 $helper = $fb->getRedirectLoginHelper();
22 22
 
23 23
 try {
24
-  $accessToken = $helper->getAccessToken();
24
+    $accessToken = $helper->getAccessToken();
25 25
 } catch(Facebook\Exceptions\FacebookResponseException $e) {
26
-  // When Graph returns an error
27
-  echo 'Graph returned an error: ' . $e->getMessage();
28
-  exit;
26
+    // When Graph returns an error
27
+    echo 'Graph returned an error: ' . $e->getMessage();
28
+    exit;
29 29
 } catch(Facebook\Exceptions\FacebookSDKException $e) {
30
-  // When validation fails or other local issues
31
-  echo 'Facebook SDK returned an error: ' . $e->getMessage();
32
-  exit;
30
+    // When validation fails or other local issues
31
+    echo 'Facebook SDK returned an error: ' . $e->getMessage();
32
+    exit;
33 33
 }
34 34
 
35 35
 if (! isset($accessToken)) {
36 36
   
37
-  if ($helper->getError()) {
37
+    if ($helper->getError()) {
38 38
     header('HTTP/1.0 401 Unauthorized');
39 39
     echo "Error: " . $helper->getError() . "\n";
40 40
     echo "Error Code: " . $helper->getErrorCode() . "\n";
41 41
     echo "Error Reason: " . $helper->getErrorReason() . "\n";
42 42
     echo "Error Description: " . $helper->getErrorDescription() . "\n";
43
-  } else {
43
+    } else {
44 44
     header('HTTP/1.0 400 Bad Request');
45 45
     echo 'Bad request';
46
-  }
47
-  exit;
46
+    }
47
+    exit;
48 48
 }
49 49
 
50 50
 // Logged in
@@ -66,37 +66,37 @@  discard block
 block discarded – undo
66 66
 $tokenMetadata->validateExpiration();
67 67
 
68 68
 if (! $accessToken->isLongLived()) {
69
-  // Exchanges a short-lived access token for a long-lived one
70
-  try {
69
+    // Exchanges a short-lived access token for a long-lived one
70
+    try {
71 71
     $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
72
-  } catch (Facebook\Exceptions\FacebookSDKException $e) {
72
+    } catch (Facebook\Exceptions\FacebookSDKException $e) {
73 73
     echo "<p>Error getting long-lived access token: " . $e->getMessage() . "</p>\n\n";
74 74
     exit;
75
-  }
75
+    }
76 76
 
77
-  echo '<h3>Long-lived</h3>';
78
-  var_dump($accessToken->getValue());
77
+    echo '<h3>Long-lived</h3>';
78
+    var_dump($accessToken->getValue());
79 79
 }
80 80
 
81 81
 $_SESSION['fb_access_token'] = (string) $accessToken;
82 82
 
83 83
 try {
84
-  // Returns a `Facebook\FacebookResponse` object
85
-  $response = $fb->get('/me?fields=id,name', $accessToken);
84
+    // Returns a `Facebook\FacebookResponse` object
85
+    $response = $fb->get('/me?fields=id,name', $accessToken);
86 86
 } catch(Facebook\Exceptions\FacebookResponseException $e) {
87
-  echo 'Graph returned an error: ' . $e->getMessage();
88
-  exit;
87
+    echo 'Graph returned an error: ' . $e->getMessage();
88
+    exit;
89 89
 } catch(Facebook\Exceptions\FacebookSDKException $e) {
90
-  echo 'Facebook SDK returned an error: ' . $e->getMessage();
91
-  exit;
90
+    echo 'Facebook SDK returned an error: ' . $e->getMessage();
91
+    exit;
92 92
 }
93 93
 
94 94
 $_SESSION['user'] = $response->getGraphUser();
95 95
 
96 96
 if(isset($_SESSION['user']) && isset($_SESSION['fb_access_token'])){
97
-  header('Location:member.php');
97
+    header('Location:member.php');
98 98
 }else{
99
-  header('Location:index.php');
99
+    header('Location:index.php');
100 100
 }
101 101
 }
102 102
 ?>
103 103
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if(!session_id()) {
2
+if (!session_id()) {
3 3
   session_start();
4 4
 }
5 5
 require_once 'lib\Facebook\autoload.php';
6 6
 
7
-if(isset($_SESSION['fb_access_token'])){
7
+if (isset($_SESSION['fb_access_token'])) {
8 8
   // Get access token from session
9 9
   $accessToken = $_SESSION['fb_access_token'];
10 10
   //header('location:member.php');
11
-}else{
12
-  $appId='362540437809242';
13
-  $appSecret='538cd04f971479ff14dc409df2fbcf3b';
11
+} else {
12
+  $appId = '362540437809242';
13
+  $appSecret = '538cd04f971479ff14dc409df2fbcf3b';
14 14
 
15 15
 $fb = new Facebook\Facebook([
16 16
   'app_id' => $appId, // variable with My Facebook App ID
@@ -22,17 +22,17 @@  discard block
 block discarded – undo
22 22
 
23 23
 try {
24 24
   $accessToken = $helper->getAccessToken();
25
-} catch(Facebook\Exceptions\FacebookResponseException $e) {
25
+} catch (Facebook\Exceptions\FacebookResponseException $e) {
26 26
   // When Graph returns an error
27 27
   echo 'Graph returned an error: ' . $e->getMessage();
28 28
   exit;
29
-} catch(Facebook\Exceptions\FacebookSDKException $e) {
29
+} catch (Facebook\Exceptions\FacebookSDKException $e) {
30 30
   // When validation fails or other local issues
31 31
   echo 'Facebook SDK returned an error: ' . $e->getMessage();
32 32
   exit;
33 33
 }
34 34
 
35
-if (! isset($accessToken)) {
35
+if (!isset($accessToken)) {
36 36
   
37 37
   if ($helper->getError()) {
38 38
     header('HTTP/1.0 401 Unauthorized');
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 //$tokenMetadata->validateUserId('123');
66 66
 $tokenMetadata->validateExpiration();
67 67
 
68
-if (! $accessToken->isLongLived()) {
68
+if (!$accessToken->isLongLived()) {
69 69
   // Exchanges a short-lived access token for a long-lived one
70 70
   try {
71 71
     $accessToken = $oAuth2Client->getLongLivedAccessToken($accessToken);
@@ -78,24 +78,24 @@  discard block
 block discarded – undo
78 78
   var_dump($accessToken->getValue());
79 79
 }
80 80
 
81
-$_SESSION['fb_access_token'] = (string) $accessToken;
81
+$_SESSION['fb_access_token'] = (string)$accessToken;
82 82
 
83 83
 try {
84 84
   // Returns a `Facebook\FacebookResponse` object
85 85
   $response = $fb->get('/me?fields=id,name', $accessToken);
86
-} catch(Facebook\Exceptions\FacebookResponseException $e) {
86
+} catch (Facebook\Exceptions\FacebookResponseException $e) {
87 87
   echo 'Graph returned an error: ' . $e->getMessage();
88 88
   exit;
89
-} catch(Facebook\Exceptions\FacebookSDKException $e) {
89
+} catch (Facebook\Exceptions\FacebookSDKException $e) {
90 90
   echo 'Facebook SDK returned an error: ' . $e->getMessage();
91 91
   exit;
92 92
 }
93 93
 
94 94
 $_SESSION['user'] = $response->getGraphUser();
95 95
 
96
-if(isset($_SESSION['user']) && isset($_SESSION['fb_access_token'])){
96
+if (isset($_SESSION['user']) && isset($_SESSION['fb_access_token'])) {
97 97
   header('Location:member.php');
98
-}else{
98
+} else {
99 99
   header('Location:index.php');
100 100
 }
101 101
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
   // Get access token from session
9 9
   $accessToken = $_SESSION['fb_access_token'];
10 10
   //header('location:member.php');
11
-}else{
11
+} else{
12 12
   $appId='362540437809242';
13 13
   $appSecret='538cd04f971479ff14dc409df2fbcf3b';
14 14
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
 if(isset($_SESSION['user']) && isset($_SESSION['fb_access_token'])){
97 97
   header('Location:member.php');
98
-}else{
98
+} else{
99 99
   header('Location:index.php');
100 100
 }
101 101
 }
Please login to merge, or discard this patch.