Passed
Push — master ( c5754d...f173b7 )
by Darío
05:12
created
module/Connections/Module.php 1 patch
Braces   +22 added lines, -18 removed lines patch added patch discarded remove patch
@@ -24,8 +24,9 @@  discard block
 block discarded – undo
24 24
      */
25 25
     private function getUserAdapter()
26 26
     {
27
-        if (!is_null($this->userAdapter))
28
-            return $this->userAdapter;
27
+        if (!is_null($this->userAdapter)) {
28
+                    return $this->userAdapter;
29
+        }
29 30
 
30 31
         $this->userAdapter = new EntityAdapter(new UserTbl(new User()));
31 32
 
@@ -48,8 +49,9 @@  discard block
 block discarded – undo
48 49
          * when users log in. It should be an unique session id for the app to prevent bad redirections with other projects.
49 50
          */
50 51
         # save only no XmlHttpRequest!
51
-        if (!$c->isXmlHttpRequest())
52
-            $_SESSION["last_uri_" . $global_config["project"]["id"]] = $_SERVER["REQUEST_URI"];
52
+        if (!$c->isXmlHttpRequest()) {
53
+                    $_SESSION["last_uri_" . $global_config["project"]["id"]] = $_SERVER["REQUEST_URI"];
54
+        }
53 55
 
54 56
         # config constraints
55 57
         $components = [
@@ -133,9 +135,9 @@  discard block
 block discarded – undo
133 135
                         $c->stopExecution(false);
134 136
 
135 137
                         header("location: " . $c->getBasePath() . "/public/" . $redirect);
138
+                    } else {
139
+                                            $username_credential = $_COOKIE[$key];
136 140
                     }
137
-                    else
138
-                        $username_credential = $_COOKIE[$key];
139 141
 
140 142
                     break;
141 143
 
@@ -147,9 +149,9 @@  discard block
 block discarded – undo
147 149
                         $c->stopExecution(false);
148 150
 
149 151
                         header("location: " . $c->getBasePath() . "/public/" . $redirect);
152
+                    } else {
153
+                                            $username_credential = $_SESSION[$key];
150 154
                     }
151
-                    else
152
-                        $username_credential = $_SESSION[$key];
153 155
 
154 156
                     break;
155 157
             }
@@ -161,10 +163,10 @@  discard block
 block discarded – undo
161 163
             $state_field  = $config["authentication"]["gateway"]["table_info"]["columns"]["state_field"];
162 164
             $active_state = $config["authentication"]["gateway"]["table_info"]["column_values"]["state_field"]["user_active"];
163 165
 
164
-            if ($user->{$state_field} != $active_state)
165
-                throw new \Exception("The user has been inactived!. Please log-in again.");
166
-        }
167
-        catch (\Exception $e)
166
+            if ($user->{$state_field} != $active_state) {
167
+                            throw new \Exception("The user has been inactived!. Please log-in again.");
168
+            }
169
+        } catch (\Exception $e)
168 170
         {
169 171
             $file = str_replace('\\', '', __CLASS__);
170 172
             $storage = new \Drone\Exception\Storage("cache/$file.json");
@@ -194,10 +196,11 @@  discard block
 block discarded – undo
194 196
             $layoutManager->setParams($data);
195 197
 
196 198
             # for AJAX requests!
197
-            if ($c->isXmlHttpRequest())
198
-                $layoutManager->content();
199
-            else
200
-                $layoutManager->fromTemplate($this, 'blank');
199
+            if ($c->isXmlHttpRequest()) {
200
+                            $layoutManager->content();
201
+            } else {
202
+                            $layoutManager->fromTemplate($this, 'blank');
203
+            }
201 204
         }
202 205
     }
203 206
 
@@ -207,8 +210,9 @@  discard block
 block discarded – undo
207 210
 
208 211
         if (array_key_exists('locale', $_GET))
209 212
         {
210
-            if (in_array($_GET['locale'], ['en', 'es', 'fr']))
211
-                $_SESSION["LOCALE"] = $_GET['locale'];
213
+            if (in_array($_GET['locale'], ['en', 'es', 'fr'])) {
214
+                            $_SESSION["LOCALE"] = $_GET['locale'];
215
+            }
212 216
         }
213 217
 
214 218
         $locale = (array_key_exists('LOCALE', $_SESSION)) ? $_SESSION["LOCALE"] : $config["environment"]["locale"];
Please login to merge, or discard this patch.