Passed
Push — master ( d5829e...7fef5d )
by Luiz Kim
09:36 queued 07:32
created
src/Repository/UserRepository.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@
 block discarded – undo
28 28
     public function updatePassword(string $email, string $password): ?User
29 29
     {
30 30
         if ($user = $this->findOneByEmail($email)) {
31
-          $user->setPassword($password);
31
+            $user->setPassword($password);
32 32
 
33
-          $this->getEntityManager()->persist($user);
33
+            $this->getEntityManager()->persist($user);
34 34
 
35
-          $this->getEntityManager()->flush();
35
+            $this->getEntityManager()->flush();
36 36
 
37
-          return $user;
37
+            return $user;
38 38
         }
39 39
     }
40 40
 
Please login to merge, or discard this patch.
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 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -14,23 +14,23 @@  discard block
 block discarded – undo
14 14
 {
15 15
 
16 16
 
17
-  public function __construct(
17
+    public function __construct(
18 18
     private PeopleRoleService $roleService,
19 19
     private EntityManagerInterface $manager,
20
-  ) {
21
-  }
20
+    ) {
21
+    }
22 22
 
23
-  public function __invoke(Request $request)
24
-  {
23
+    public function __invoke(Request $request)
24
+    {
25 25
     /**
26 26
      * @var \ControleOnline\Entity\User
27 27
      */
28 28
     $user = $this->getUser();
29 29
 
30 30
     if ($user === null)
31
-      return $this->json([
31
+        return $this->json([
32 32
         'error' => 'User not found'
33
-      ]);
33
+        ]);
34 34
 
35 35
     // get contact data from user
36 36
 
@@ -39,56 +39,56 @@  discard block
 block discarded – undo
39 39
     $number = '';
40 40
 
41 41
     if ($user->getPeople()->getEmail()->count() > 0)
42
-      $email = $user->getPeople()->getEmail()->first()->getEmail();
42
+        $email = $user->getPeople()->getEmail()->first()->getEmail();
43 43
 
44 44
     if ($user->getPeople()->getPhone()->count() > 0) {
45
-      $phone  = $user->getPeople()->getPhone()->first();
46
-      $code   = $phone->getDdd();
47
-      $number = $phone->getPhone();
45
+        $phone  = $user->getPeople()->getPhone()->first();
46
+        $code   = $phone->getDdd();
47
+        $number = $phone->getPhone();
48 48
     }
49 49
 
50 50
     return $this->json([
51
-      'username' => $user->getUsername(),
52
-      'roles'    => $user->getRoles(),
53
-      'api_key'  => $user->getApiKey(),
54
-      'people'   => $user->getPeople()->getId(),
55
-      'mycompany'  => $this->getCompanyId($user),
56
-      'realname' => $this->getUserRealName($user->getPeople()),
57
-      'avatar'   => $user->getPeople()->getFile() ? '/files/download/' . $user->getPeople()->getFile()->getId() : null,
58
-      'email'    => $email,
59
-      'phone'    => sprintf('%s%s', $code, $number),
60
-      'active'   => (int) $user->getPeople()->getEnabled(),
51
+        'username' => $user->getUsername(),
52
+        'roles'    => $user->getRoles(),
53
+        'api_key'  => $user->getApiKey(),
54
+        'people'   => $user->getPeople()->getId(),
55
+        'mycompany'  => $this->getCompanyId($user),
56
+        'realname' => $this->getUserRealName($user->getPeople()),
57
+        'avatar'   => $user->getPeople()->getFile() ? '/files/download/' . $user->getPeople()->getFile()->getId() : null,
58
+        'email'    => $email,
59
+        'phone'    => sprintf('%s%s', $code, $number),
60
+        'active'   => (int) $user->getPeople()->getEnabled(),
61 61
     ]);
62
-  }
62
+    }
63 63
 
64
-  private function getUserRealName(People $people): string
65
-  {
64
+    private function getUserRealName(People $people): string
65
+    {
66 66
     $realName = 'John Doe';
67 67
 
68 68
     if ($people->getPeopleType() == 'J')
69
-      $realName = $people->getAlias();
69
+        $realName = $people->getAlias();
70 70
 
71 71
     else {
72
-      if ($people->getPeopleType() == 'F') {
72
+        if ($people->getPeopleType() == 'F') {
73 73
         $realName  = $people->getName();
74 74
         $realName .= ' ' . $people->getAlias();
75 75
         $realName  = trim($realName);
76
-      }
76
+        }
77 77
     }
78 78
 
79 79
     return $realName;
80
-  }
80
+    }
81 81
 
82
-  private function getCompany(User $user): ?People
83
-  {
82
+    private function getCompany(User $user): ?People
83
+    {
84 84
     $peopleLink = $this->manager->getRepository(People::class)->getPeopleLinks($user->getPeople(), 'employee', 1);
85 85
     if ($peopleLink !== false && $peopleLink->getCompany() instanceof People)
86
-      return $peopleLink->getCompany();
87
-  }
86
+        return $peopleLink->getCompany();
87
+    }
88 88
 
89
-  private function getCompanyId(User $user): ?int
90
-  {
89
+    private function getCompanyId(User $user): ?int
90
+    {
91 91
     $company = $this->getCompany($user);
92 92
     return $company ? $company->getId() : null;
93
-  }
93
+    }
94 94
 }
Please login to merge, or discard this 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/Controller/Oauth/GoogleReturnController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
         $this->provider = new Google([
27 27
             'clientId'     => $this->clientId,
28 28
             'clientSecret' => $this->clientSecret,
29
-            'redirectUri'  => 'https://' . $this->domainService->getMainDomain(). '/oauth/google/return',
29
+            'redirectUri'  => 'https://' . $this->domainService->getMainDomain() . '/oauth/google/return',
30 30
             //'hostedDomain' => 'example.com', // optional; used to restrict access to users on your G Suite/Google Apps for Business accounts
31 31
         ]);
32 32
         
Please login to merge, or discard this patch.
src/Controller/Oauth/FacebookController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@
 block discarded – undo
26 26
         $this->provider = new Facebook([
27 27
             'clientId'     => $this->clientId,
28 28
             'clientSecret' => $this->clientSecret,
29
-            'redirectUri'  => 'https://' . $this->domainService->getMainDomain(). '/oauth/facebook/return',
29
+            'redirectUri'  => 'https://' . $this->domainService->getMainDomain() . '/oauth/facebook/return',
30 30
             //'hostedDomain' => 'example.com', // optional; used to restrict access to users on your G Suite/Facebook Apps for Business accounts
31 31
         ]);
32 32
     }
Please login to merge, or discard this patch.
src/Controller/Oauth/InstagramController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@
 block discarded – undo
27 27
         $this->provider = new Instagram([
28 28
             'clientId'     => $this->clientId,
29 29
             'clientSecret' => $this->clientSecret,
30
-            'redirectUri'  => 'https://' .$this->domainService->getMainDomain() . '/oauth/instagram/return',
30
+            'redirectUri'  => 'https://' . $this->domainService->getMainDomain() . '/oauth/instagram/return',
31 31
             //'hostedDomain' => 'example.com', // optional; used to restrict access to users on your G Suite/Instagram Apps for Business accounts
32 32
         ]);
33 33
     }
Please login to merge, or discard this patch.