Passed
Push — master ( db2ea2...f95733 )
by Luiz Kim
02:09
created
src/Controller/Oauth/DefaultClientController.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -95,10 +95,11 @@  discard block
 block discarded – undo
95 95
             ->findOneBy([
96 96
                 'username'       => $ownerDetails->getEmail(),
97 97
             ]);
98
-        if (!$user)
99
-
98
+        if (!$user) {
99
+        
100 100
 
101 101
             $user = $this->createUser($ownerDetails);
102
+        }
102 103
 
103 104
 
104 105
 
@@ -122,20 +123,23 @@  discard block
 block discarded – undo
122 123
         try {
123 124
 
124 125
 
125
-            if ($request->get('code'))
126
-                $token = $this->provider->getAccessToken('authorization_code', [
126
+            if ($request->get('code')) {
127
+                            $token = $this->provider->getAccessToken('authorization_code', [
127 128
                     'code' => $request->get('code')
128 129
                 ]);
130
+            }
129 131
 
130
-            if ($request->get('access_token'))
131
-                $token = new AccessToken([
132
+            if ($request->get('access_token')) {
133
+                            $token = new AccessToken([
132 134
                     'access_token' => $request->get('access_token'),
133 135
                 ]);
136
+            }
134 137
 
135
-            if ($request->get('code'))
136
-                $token = $this->provider->getAccessToken('authorization_code', [
138
+            if ($request->get('code')) {
139
+                            $token = $this->provider->getAccessToken('authorization_code', [
137 140
                     'code' => $request->get('code')
138 141
                 ]);
142
+            }
139 143
 
140 144
 
141 145
             $data = $this->discoveryUser($token);
@@ -164,8 +168,9 @@  discard block
 block discarded – undo
164 168
     {
165 169
         $peopleLink = $user->getPeople()->getLink()->first();
166 170
 
167
-        if ($peopleLink !== false && $peopleLink->getCompany() instanceof People)
168
-            return $peopleLink->getCompany();
171
+        if ($peopleLink !== false && $peopleLink->getCompany() instanceof People) {
172
+                    return $peopleLink->getCompany();
173
+        }
169 174
     }
170 175
 
171 176
     private function getCompanyId(User $user)
Please login to merge, or discard this patch.
src/Controller/SecurityController.php 1 patch
Braces   +12 added lines, -10 removed lines patch added patch discarded remove patch
@@ -27,10 +27,11 @@  discard block
 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
     // get contact data from user
36 37
 
@@ -38,8 +39,9 @@  discard block
 block discarded – undo
38 39
     $code   = '';
39 40
     $number = '';
40 41
 
41
-    if ($user->getPeople()->getEmail()->count() > 0)
42
-      $email = $user->getPeople()->getEmail()->first()->getEmail();
42
+    if ($user->getPeople()->getEmail()->count() > 0) {
43
+          $email = $user->getPeople()->getEmail()->first()->getEmail();
44
+    }
43 45
 
44 46
     if ($user->getPeople()->getPhone()->count() > 0) {
45 47
       $phone  = $user->getPeople()->getPhone()->first();
@@ -65,10 +67,9 @@  discard block
 block discarded – undo
65 67
   {
66 68
     $realName = 'John Doe';
67 69
 
68
-    if ($people->getPeopleType() == 'J')
69
-      $realName = $people->getAlias();
70
-
71
-    else {
70
+    if ($people->getPeopleType() == 'J') {
71
+          $realName = $people->getAlias();
72
+    } else {
72 73
       if ($people->getPeopleType() == 'F') {
73 74
         $realName  = $people->getName();
74 75
         $realName .= ' ' . $people->getAlias();
@@ -82,8 +83,9 @@  discard block
 block discarded – undo
82 83
   private function getCompany(User $user): ?People
83 84
   {
84 85
     $peopleLink = $this->manager->getRepository(People::class)->getPeopleLinks($user->getPeople(), 'employee', 1);
85
-    if ($peopleLink !== false && $peopleLink->getCompany() instanceof People)
86
-      return $peopleLink->getCompany();
86
+    if ($peopleLink !== false && $peopleLink->getCompany() instanceof People) {
87
+          return $peopleLink->getCompany();
88
+    }
87 89
   }
88 90
 
89 91
   private function getCompanyId(User $user): ?int
Please login to merge, or discard this patch.
src/Service/UserService.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,8 +13,9 @@  discard block
 block discarded – undo
13 13
   public function __construct(private EntityManagerInterface $manager, private  UserPasswordEncoderInterface $encoder) {}
14 14
   public function changePassword(User $user, $password)
15 15
   {
16
-    if (!$this->getPermission())
17
-      throw new Exception("You should not pass!!!", 301);
16
+    if (!$this->getPermission()) {
17
+          throw new Exception("You should not pass!!!", 301);
18
+    }
18 19
 
19 20
     $user->setHash(
20 21
       $this->encoder->encodePassword($user, $password)
@@ -27,8 +28,9 @@  discard block
 block discarded – undo
27 28
 
28 29
   public function createUser(People $people, $username, $password)
29 30
   {
30
-    if (!$this->getPermission())
31
-      throw new Exception("You should not pass!!!", 301);
31
+    if (!$this->getPermission()) {
32
+          throw new Exception("You should not pass!!!", 301);
33
+    }
32 34
 
33 35
     $user = new User();
34 36
     $user->setPeople($people);
Please login to merge, or discard this patch.