Test Setup Failed
Push — master ( fe2f92...0d9200 )
by Filippo
02:52
created
src/Facebook/ObjectDebugger/Command/RefreshCommand.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,6 @@
 block discarded – undo
15 15
 use Symfony\Component\Console\Input\InputInterface;
16 16
 use Symfony\Component\Console\Output\OutputInterface;
17 17
 use Symfony\Component\Console\Input\InputOption;
18
-
19 18
 use Facebook\Facebook;
20 19
 
21 20
 
Please login to merge, or discard this patch.
Braces   +33 added lines, -28 removed lines patch added patch discarded remove patch
@@ -87,8 +87,9 @@  discard block
 block discarded – undo
87 87
   private function scrape($url) {
88 88
     $this->output->write($url);
89 89
 
90
-    if ($this->input->getOption('encode'))
91
-      $url = urlencode($url);
90
+    if ($this->input->getOption('encode')) {
91
+          $url = urlencode($url);
92
+    }
92 93
 
93 94
     $params = [
94 95
       'id' => $url,
@@ -113,26 +114,29 @@  discard block
 block discarded – undo
113 114
 
114 115
     $config = $this->getApplication()->getConfig();
115 116
 
116
-    if ($input->getOption('id'))
117
-      $appId = $input->getOption('id');
118
-    elseif (array_key_exists('appId', $config))
119
-      $appId = $config['appId'];
120
-    else
121
-      throw new InvalidOptionException('Facebook Open Graph requires an App ID.');
122
-
123
-    if ($input->getOption('secret'))
124
-      $appSecret = $input->getOption('secret');
125
-    elseif (array_key_exists('appSecret', $config))
126
-      $appSecret = $config['appSecret'];
127
-    else
128
-      throw new InvalidOptionException('Facebook Open Graph requires an App Secret.');
129
-
130
-    if ($input->getOption('token'))
131
-      $accessToken = $input->getOption('token');
132
-    elseif (array_key_exists('appAccessToken', $config))
133
-      $accessToken = $config['appAccessToken'];
134
-    else
135
-      throw new InvalidOptionException('Facebook Open Graph requires an App|User Access Token.');
117
+    if ($input->getOption('id')) {
118
+          $appId = $input->getOption('id');
119
+    } elseif (array_key_exists('appId', $config)) {
120
+          $appId = $config['appId'];
121
+    } else {
122
+          throw new InvalidOptionException('Facebook Open Graph requires an App ID.');
123
+    }
124
+
125
+    if ($input->getOption('secret')) {
126
+          $appSecret = $input->getOption('secret');
127
+    } elseif (array_key_exists('appSecret', $config)) {
128
+          $appSecret = $config['appSecret'];
129
+    } else {
130
+          throw new InvalidOptionException('Facebook Open Graph requires an App Secret.');
131
+    }
132
+
133
+    if ($input->getOption('token')) {
134
+          $accessToken = $input->getOption('token');
135
+    } elseif (array_key_exists('appAccessToken', $config)) {
136
+          $accessToken = $config['appAccessToken'];
137
+    } else {
138
+          throw new InvalidOptionException('Facebook Open Graph requires an App|User Access Token.');
139
+    }
136 140
 
137 141
     $this->fb = new Facebook([
138 142
       'app_id' => $appId,
@@ -143,15 +147,16 @@  discard block
 block discarded – undo
143 147
 
144 148
     if ($url = $input->getOption('url')) {
145 149
       $this->scrape($url);
146
-    }
147
-    elseif ($fileName = $input->getOption('file')) {
150
+    } elseif ($fileName = $input->getOption('file')) {
148 151
       $urls = file($fileName, FILE_IGNORE_NEW_LINES);
149 152
 
150
-      if ($urls === FALSE)
151
-        throw new \RuntimeException('Cannot open the file.');
153
+      if ($urls === FALSE) {
154
+              throw new \RuntimeException('Cannot open the file.');
155
+      }
152 156
 
153
-      foreach ($urls as $url)
154
-        $this->scrape($url);
157
+      foreach ($urls as $url) {
158
+              $this->scrape($url);
159
+      }
155 160
     }
156 161
   }
157 162
 
Please login to merge, or discard this patch.