Passed
Push — master ( e2ab3d...27d13a )
by Alexandre
02:39
created
src/Extensions/OpenID/Endpoints/AuthorizationEndpoint.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
             return $this->resourceOwner->authenticate($this->prompt == self::PROMPT_SELECT_ACCOUNT, $this->loginHint);
97 97
         }
98 98
 
99
-        if($this->idTokenHint) {
99
+        if ($this->idTokenHint) {
100 100
             // check if user associated to this id token is the current user.
101 101
 //                var_dump($this->idTokenHint['sub']);die;
102
-            if($this->idTokenHint['sub'] !== $this->resourceOwner->getIdentifier()) {
103
-                if($this->prompt == self::PROMPT_NONE) {
102
+            if ($this->idTokenHint['sub'] !== $this->resourceOwner->getIdentifier()) {
103
+                if ($this->prompt == self::PROMPT_NONE) {
104 104
                     throw new OAuthException('invalid_request');
105 105
                 }
106 106
                 else {
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         $this->maxAge = empty($requestData['max_age']) ? null : $requestData['max_age'];
161 161
         $this->uiLocales = empty($requestData['ui_locales']) ? null : explode(' ', $requestData['ui_locales']);
162 162
 
163
-        if(!empty($requestData['id_token_hint'])) {
163
+        if (!empty($requestData['id_token_hint'])) {
164 164
             try {
165 165
                 $this->idTokenHint = $this->idTokenManager->decode($requestData['id_token_hint']);
166 166
             } catch (\Exception $exception) {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -102,8 +102,7 @@
 block discarded – undo
102 102
             if($this->idTokenHint['sub'] !== $this->resourceOwner->getIdentifier()) {
103 103
                 if($this->prompt == self::PROMPT_NONE) {
104 104
                     throw new OAuthException('invalid_request');
105
-                }
106
-                else {
105
+                } else {
107 106
                     throw new OAuthException('login_required');
108 107
                 }
109 108
             }
Please login to merge, or discard this patch.
src/Extensions/OpenID/Models/AddressClaim.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -142,22 +142,22 @@
 block discarded – undo
142 142
     function jsonSerialize()
143 143
     {
144 144
         $data = [];
145
-        if($this->formatted) {
145
+        if ($this->formatted) {
146 146
             $data['formatted'] = $this->formatted;
147 147
         }
148
-        if($this->streetAddress) {
148
+        if ($this->streetAddress) {
149 149
             $data['street_address'] = $this->streetAddress;
150 150
         }
151
-        if($this->locality) {
151
+        if ($this->locality) {
152 152
             $data['locality'] = $this->locality;
153 153
         }
154
-        if($this->region) {
154
+        if ($this->region) {
155 155
             $data['region'] = $this->region;
156 156
         }
157
-        if($this->postalCode) {
157
+        if ($this->postalCode) {
158 158
             $data['postal_code'] = $this->postalCode;
159 159
         }
160
-        if($this->country) {
160
+        if ($this->country) {
161 161
             $data['country'] = $this->country;
162 162
         }
163 163
         return empty($data) ? '' : json_encode($data);
Please login to merge, or discard this patch.
src/Extensions/OpenID/Models/StandardClaims.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -445,7 +445,7 @@
 block discarded – undo
445 445
     {
446 446
         $getter = 'get'.ucfirst($this->snakeToCamel($offset));
447 447
         $result = $this->{$getter}();
448
-        if(is_object($result)) {
448
+        if (is_object($result)) {
449 449
             return json_encode($result);
450 450
         }
451 451
         return $result;
Please login to merge, or discard this patch.
src/Extensions/OpenID/IdTokenManager.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@
 block discarded – undo
51 51
     }
52 52
 
53 53
     public function issueIdToken(RegisteredClient $client,
54
-                                 string $resourceOwnerIdentifier,
55
-                                 array $additionalClaims = []): string
54
+                                    string $resourceOwnerIdentifier,
55
+                                    array $additionalClaims = []): string
56 56
     {
57 57
         $metadata = $client->getMetadata();
58 58
 
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     public function decode(string $idToken): IdTokenInterface
38 38
     {
39 39
         $claims = $this->jwt->decode($idToken, self::KEY, 'HS256');
40
-        $idToken = new IdToken((array)$claims);
40
+        $idToken = new IdToken((array) $claims);
41 41
         return $idToken;
42 42
     }
43 43
 
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
             $alg = $metadata->getIdTokenSignedResponseAlg() ?: 'RS256';
61 61
         }
62 62
 
63
-        $keys=[];
63
+        $keys = [];
64 64
         $jwks = $metadata->getJwks();
65 65
 
66 66
         if (!empty($jwks)) {
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             throw new \UnexpectedValueException('Client metadata Id token signed response alg value is unexpected. 
136 136
             It must end with "256", "384" or "513"');
137 137
         }
138
-        $macAlgorithm = 'sha' . $macAlgorithm;
138
+        $macAlgorithm = 'sha'.$macAlgorithm;
139 139
 
140 140
         $hash = hash($macAlgorithm, $target, true);
141 141
         $hash = substr($hash, 0, strlen($hash) / 2);
Please login to merge, or discard this patch.
src/Extensions/OpenID/IdToken.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
 
26 26
     function getClaims() : array
27 27
     {
28
-       return $this->claims;
28
+        return $this->claims;
29 29
     }
30 30
 
31 31
     /**
Please login to merge, or discard this patch.
src/Endpoints/AuthorizationEndpoint.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -230,7 +230,7 @@
 block discarded – undo
230 230
 
231 231
             $this->redirectUri = $redirectUri;
232 232
         } catch (\InvalidArgumentException $e) {
233
-            throw new OAuthException('invalid_request', 'The request includes the malformed parameter redirect_uri. ' . $e->getMessage(),
233
+            throw new OAuthException('invalid_request', 'The request includes the malformed parameter redirect_uri. '.$e->getMessage(),
234 234
                 'https://tools.ietf.org/html/rfc6749#section-4.1');
235 235
         }
236 236
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -327,10 +327,11 @@
 block discarded – undo
327 327
         $redirectUris = $this->getClient()->getMetadata()->getRedirectUris();
328 328
         if (empty($redirectUris)) {
329 329
             if ($this->getClient() instanceof PublicClientInterface ||
330
-                ($this->getClient() instanceof ConfidentialClientInterface && $responseType == 'token'))
331
-                throw new OAuthException('invalid_request',
330
+                ($this->getClient() instanceof ConfidentialClientInterface && $responseType == 'token')) {
331
+                            throw new OAuthException('invalid_request',
332 332
                     'Clients using flows with redirection MUST register their redirection URI values',
333 333
                     'https://tools.ietf.org/html/rfc7591#section-2.1');
334
+            }
334 335
         } else {
335 336
             if ($redirectUri) {
336 337
                 if (!in_array($redirectUri, $redirectUris)) {
Please login to merge, or discard this patch.
src/Extensions/OpenID/AuthorizationGrantTypes/Flows/ImplicitFlow.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@
 block discarded – undo
120 120
         if (!in_array($macAlgorithm, [256, 384, 512])) {
121 121
             die("algotihmn not supported");
122 122
         }
123
-        $macAlgorithm = 'sha' . $macAlgorithm;
123
+        $macAlgorithm = 'sha'.$macAlgorithm;
124 124
 
125 125
 
126 126
         $atHash = hash($macAlgorithm, $accessToken['access_token'], true);
Please login to merge, or discard this patch.
src/Extensions/PKCE/Credentials/AuthorizationCode.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
                                 \DateTimeInterface $expiresAt, ?array $requestedScopes = null, ?string $redirectUri = null,
25 25
                                 ?string $codeChallenge = null, ?string $codeChallengeMethod = null)
26 26
     {
27
-       parent::__construct($code, $scopes, $clientIdentifier, $resourceOwnerIdentifier, $expiresAt, $requestedScopes, $redirectUri);
27
+        parent::__construct($code, $scopes, $clientIdentifier, $resourceOwnerIdentifier, $expiresAt, $requestedScopes, $redirectUri);
28 28
         $this->codeChallenge = $codeChallenge;
29 29
         $this->codeChallengeMethod = $codeChallengeMethod;
30 30
     }
Please login to merge, or discard this patch.
src/ScopePolicy/Policies/IgnoreScopePolicy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
 
29 29
     public function __construct(array $scopes)
30 30
     {
31
-        if(empty($scopes)) {
31
+        if (empty($scopes)) {
32 32
             throw new \InvalidArgumentException('Scope must not be an empty array');
33 33
         }
34 34
         $this->scopes = $scopes;
Please login to merge, or discard this patch.