Passed
Push — master ( 367fef...2ee8c7 )
by Luiz Kim
02:24
created
src/Security/TokenAuthenticator.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
             throw new CustomUserMessageAuthenticationException('No API token provided');
40 40
 
41 41
         return new Passport(
42
-            new UserBadge($apiToken, function ($apiToken) {
42
+            new UserBadge($apiToken, function($apiToken) {
43 43
                 $user = $this->em->getRepository(User::class)->findOneBy(['apiKey' => $apiToken]);
44 44
                 if (null === $user)
45 45
                     throw new CustomUserMessageAuthenticationException('Invalid API token');
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -35,14 +35,16 @@
 block discarded – undo
35 35
     public function authenticate(Request $request): Passport
36 36
     {
37 37
         $apiToken = $this->getKey($request);
38
-        if (null === $apiToken)
39
-            throw new CustomUserMessageAuthenticationException('No API token provided');
38
+        if (null === $apiToken) {
39
+                    throw new CustomUserMessageAuthenticationException('No API token provided');
40
+        }
40 41
 
41 42
         return new Passport(
42 43
             new UserBadge($apiToken, function ($apiToken) {
43 44
                 $user = $this->em->getRepository(User::class)->findOneBy(['apiKey' => $apiToken]);
44
-                if (null === $user)
45
-                    throw new CustomUserMessageAuthenticationException('Invalid API token');
45
+                if (null === $user) {
46
+                                    throw new CustomUserMessageAuthenticationException('Invalid API token');
47
+                }
46 48
                 return $user;
47 49
             }),
48 50
             new CustomCredentials(
Please login to merge, or discard this patch.