Passed
Push — master ( cbace6...ed8cb5 )
by Luiz Kim
09:01 queued 06:38
created
src/Controller/Oauth/DefaultClientController.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,20 +34,23 @@
 block discarded – undo
34 34
         try {
35 35
 
36 36
 
37
-            if ($request->get('code'))
38
-                $token = $this->provider->getAccessToken('authorization_code', [
37
+            if ($request->get('code')) {
38
+                            $token = $this->provider->getAccessToken('authorization_code', [
39 39
                     'code' => $request->get('code')
40 40
                 ]);
41
+            }
41 42
 
42
-            if ($request->get('access_token'))
43
-                $token = new AccessToken([
43
+            if ($request->get('access_token')) {
44
+                            $token = new AccessToken([
44 45
                     'access_token' => $request->get('access_token'),
45 46
                 ]);
47
+            }
46 48
 
47
-            if ($request->get('code'))
48
-                $token = $this->provider->getAccessToken('authorization_code', [
49
+            if ($request->get('code')) {
50
+                            $token = $this->provider->getAccessToken('authorization_code', [
49 51
                     'code' => $request->get('code')
50 52
                 ]);
53
+            }
51 54
 
52 55
             $ownerDetails = $this->provider->getResourceOwner($token);
53 56
 
Please login to merge, or discard this patch.
src/Controller/SecurityController.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,10 +27,11 @@
 block discarded – undo
27 27
      */
28 28
     $user = $this->getUser();
29 29
 
30
-    if ($user === null)
31
-      return $this->json([
30
+    if ($user === null) {
31
+          return $this->json([
32 32
         'error' => 'User not found'
33 33
       ]);
34
+    }
34 35
 
35 36
     return $this->json($this->userService->getUserSession($user));
36 37
 
Please login to merge, or discard this patch.
src/Service/UserService.php 1 patch
Braces   +24 added lines, -18 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
   ) {}
20 20
   public function changePassword(User $user, $password)
21 21
   {
22
-    if (!$this->getPermission())
23
-      throw new Exception("You should not pass!!!", 301);
22
+    if (!$this->getPermission()) {
23
+          throw new Exception("You should not pass!!!", 301);
24
+    }
24 25
 
25 26
     $user->setHash(
26 27
       $this->encoder->encodePassword($user, $password)
@@ -33,8 +34,9 @@  discard block
 block discarded – undo
33 34
 
34 35
   public function changeApiKey(User $user)
35 36
   {
36
-    if (!$this->getPermission())
37
-      throw new Exception("You should not pass!!!", 301);
37
+    if (!$this->getPermission()) {
38
+          throw new Exception("You should not pass!!!", 301);
39
+    }
38 40
 
39 41
     $user->generateApiKey();
40 42
 
@@ -55,8 +57,9 @@  discard block
 block discarded – undo
55 57
 
56 58
     $people = $this->discoveryPeople($email, $firstName, $lastName);
57 59
 
58
-    if (!$user)
59
-      $user = $this->createUser($people, $email, $password);
60
+    if (!$user) {
61
+          $user = $this->createUser($people, $email, $password);
62
+    }
60 63
 
61 64
     return   $user;
62 65
   }
@@ -70,8 +73,9 @@  discard block
 block discarded – undo
70 73
     $code   = '';
71 74
     $number = '';
72 75
 
73
-    if ($user->getPeople()->getEmail()->count() > 0)
74
-      $email = $user->getPeople()->getEmail()->first()->getEmail();
76
+    if ($user->getPeople()->getEmail()->count() > 0) {
77
+          $email = $user->getPeople()->getEmail()->first()->getEmail();
78
+    }
75 79
 
76 80
     if ($user->getPeople()->getPhone()->count() > 0) {
77 81
       $phone  = $user->getPeople()->getPhone()->first();
@@ -98,10 +102,9 @@  discard block
 block discarded – undo
98 102
   {
99 103
     $realName = 'John Doe';
100 104
 
101
-    if ($people->getPeopleType() == 'J')
102
-      $realName = $people->getAlias();
103
-
104
-    else {
105
+    if ($people->getPeopleType() == 'J') {
106
+          $realName = $people->getAlias();
107
+    } else {
105 108
       if ($people->getPeopleType() == 'F') {
106 109
         $realName  = $people->getName();
107 110
         $realName .= ' ' . $people->getAlias();
@@ -148,16 +151,18 @@  discard block
 block discarded – undo
148 151
 
149 152
   public function createUser(People $people, $username, $password)
150 153
   {
151
-    if (!$this->getPermission())
152
-      throw new Exception("You should not pass!!!", 301);
154
+    if (!$this->getPermission()) {
155
+          throw new Exception("You should not pass!!!", 301);
156
+    }
153 157
 
154 158
     $user = $this->manager->getRepository(User::class)
155 159
       ->findOneBy([
156 160
         'username'       => $username,
157 161
       ]);
158 162
 
159
-    if ($user)
160
-      throw new Exception("User already exists", 301);
163
+    if ($user) {
164
+          throw new Exception("User already exists", 301);
165
+    }
161 166
 
162 167
     $user = new User();
163 168
     $user->setPeople($people);
@@ -174,8 +179,9 @@  discard block
 block discarded – undo
174 179
   {
175 180
     $peopleLink = $user->getPeople()->getLink()->first();
176 181
 
177
-    if ($peopleLink !== false && $peopleLink->getCompany() instanceof People)
178
-      return $peopleLink->getCompany();
182
+    if ($peopleLink !== false && $peopleLink->getCompany() instanceof People) {
183
+          return $peopleLink->getCompany();
184
+    }
179 185
   }
180 186
 
181 187
   public function getCompanyId(User $user)
Please login to merge, or discard this patch.