Passed
Push — master ( 6918e4...36a8fd )
by Luiz Kim
02:28
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
@@ -15,8 +15,9 @@  discard block
 block discarded – undo
15 15
   public function __construct(private EntityManagerInterface $manager, private  UserPasswordEncoderInterface $encoder) {}
16 16
   public function changePassword(User $user, $password)
17 17
   {
18
-    if (!$this->getPermission())
19
-      throw new Exception("You should not pass!!!", 301);
18
+    if (!$this->getPermission()) {
19
+          throw new Exception("You should not pass!!!", 301);
20
+    }
20 21
 
21 22
     $user->setHash(
22 23
       $this->encoder->encodePassword($user, $password)
@@ -29,8 +30,9 @@  discard block
 block discarded – undo
29 30
 
30 31
   public function changeApiKey(User $user)
31 32
   {
32
-    if (!$this->getPermission())
33
-      throw new Exception("You should not pass!!!", 301);
33
+    if (!$this->getPermission()) {
34
+          throw new Exception("You should not pass!!!", 301);
35
+    }
34 36
 
35 37
     $user->generateApiKey();
36 38
 
@@ -51,8 +53,9 @@  discard block
 block discarded – undo
51 53
 
52 54
     $people = $this->discoveryPeople($email, $firstName, $lastName);
53 55
 
54
-    if (!$user)
55
-      $user = $this->createUser($people, $email, $password);
56
+    if (!$user) {
57
+          $user = $this->createUser($people, $email, $password);
58
+    }
56 59
 
57 60
     return   $user;
58 61
   }
@@ -66,8 +69,9 @@  discard block
 block discarded – undo
66 69
     $code   = '';
67 70
     $number = '';
68 71
 
69
-    if ($user->getPeople()->getEmail()->count() > 0)
70
-      $email = $user->getPeople()->getEmail()->first()->getEmail();
72
+    if ($user->getPeople()->getEmail()->count() > 0) {
73
+          $email = $user->getPeople()->getEmail()->first()->getEmail();
74
+    }
71 75
 
72 76
     if ($user->getPeople()->getPhone()->count() > 0) {
73 77
       $phone  = $user->getPeople()->getPhone()->first();
@@ -94,10 +98,9 @@  discard block
 block discarded – undo
94 98
   {
95 99
     $realName = 'John Doe';
96 100
 
97
-    if ($people->getPeopleType() == 'J')
98
-      $realName = $people->getAlias();
99
-
100
-    else {
101
+    if ($people->getPeopleType() == 'J') {
102
+          $realName = $people->getAlias();
103
+    } else {
101 104
       if ($people->getPeopleType() == 'F') {
102 105
         $realName  = $people->getName();
103 106
         $realName .= ' ' . $people->getAlias();
@@ -144,16 +147,18 @@  discard block
 block discarded – undo
144 147
 
145 148
   public function createUser(People $people, $username, $password)
146 149
   {
147
-    if (!$this->getPermission())
148
-      throw new Exception("You should not pass!!!", 301);
150
+    if (!$this->getPermission()) {
151
+          throw new Exception("You should not pass!!!", 301);
152
+    }
149 153
 
150 154
     $user = $this->manager->getRepository(User::class)
151 155
       ->findOneBy([
152 156
         'username'       => $username,
153 157
       ]);
154 158
 
155
-    if ($username)
156
-      throw new Exception("User already exists", 301);
159
+    if ($username) {
160
+          throw new Exception("User already exists", 301);
161
+    }
157 162
 
158 163
     $user = new User();
159 164
     $user->setPeople($people);
@@ -170,8 +175,9 @@  discard block
 block discarded – undo
170 175
   {
171 176
     $peopleLink = $user->getPeople()->getLink()->first();
172 177
 
173
-    if ($peopleLink !== false && $peopleLink->getCompany() instanceof People)
174
-      return $peopleLink->getCompany();
178
+    if ($peopleLink !== false && $peopleLink->getCompany() instanceof People) {
179
+          return $peopleLink->getCompany();
180
+    }
175 181
   }
176 182
 
177 183
   public function getCompanyId(User $user)
Please login to merge, or discard this patch.