Completed
Pull Request — master (#15)
by Oguzhan
02:18
created
src/Tests/Authenticator/AuthenticatorTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
     {
176 176
         $authenticator = new Authenticator($this->keys);
177 177
         $request       = new Request();
178
-        $request->headers->set('Authorization', 'Bearer ' . self::TEST_TOKEN);
178
+        $request->headers->set('Authorization', 'Bearer '.self::TEST_TOKEN);
179 179
         $token = $authenticator->createToken($request, 'myprovider');
180 180
 
181 181
         $expected = new JwtToken(self::TEST_TOKEN);
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
         $result = $authenticator->setUserRolesFromAudienceClaims($user, $token);
211 211
 
212
-        $this->assertEquals(['guests','users'], $result->getRoles());
212
+        $this->assertEquals(['guests', 'users'], $result->getRoles());
213 213
     }
214 214
 
215 215
     /**
Please login to merge, or discard this patch.
src/Authenticator/Authenticator.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -129,14 +129,14 @@
 block discarded – undo
129 129
         /** @var JwtToken $credentials */
130 130
         $credentials = $token->getCredentials();
131 131
 
132
-        foreach($credentials->getClaims() as $claimKey => $claimValue)
132
+        foreach ($credentials->getClaims() as $claimKey => $claimValue)
133 133
         {
134
-            if($claimKey === 'aud' && method_exists($user, 'addRole')) {
135
-                if(is_array($claimValue)) {
136
-                    foreach($claimValue as $role) {
134
+            if ($claimKey === 'aud' && method_exists($user, 'addRole')) {
135
+                if (is_array($claimValue)) {
136
+                    foreach ($claimValue as $role) {
137 137
                         $user->addRole($role);
138 138
                     }
139
-                } elseif(is_string($claimValue)) {
139
+                } elseif (is_string($claimValue)) {
140 140
                     $user->addRole($claimValue);
141 141
                 }
142 142
             }
Please login to merge, or discard this patch.