Passed
Push — master ( abde4f...d8eef7 )
by Thomas Mauro
02:52
created
src/AuthMethod/ClientSecretJwt.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             return $this->jwsBuilder;
48 48
         }
49 49
 
50
-        if (! \class_exists(HS256::class)) {
50
+        if (!\class_exists(HS256::class)) {
51 51
             throw new LogicException('To use the client_secret_jwt auth method you should install web-token/jwt-signature-algorithm-hmac package');
52 52
         }
53 53
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
         $clientId = $client->getMetadata()->getClientId();
63 63
         $clientSecret = $client->getMetadata()->getClientSecret();
64 64
 
65
-        if (! $clientSecret) {
65
+        if (!$clientSecret) {
66 66
             throw new InvalidArgumentException($this->getSupportedMethod() . ' cannot be used without client_secret metadata');
67 67
         }
68 68
 
Please login to merge, or discard this patch.
src/Token/IdTokenVerifier.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
             ? $metadata->getUserinfoSignedResponseAlg()
84 84
             : $metadata->getIdTokenSignedResponseAlg();
85 85
 
86
-        if (! $expectedAlg) {
86
+        if (!$expectedAlg) {
87 87
             throw new RuntimeException('Unable to verify id_token without an alg value');
88 88
         }
89 89
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
         $payload = \json_decode(base64url_decode(\explode('.', $idToken)[1] ?? '{}'), true);
97 97
 
98
-        if (! \is_array($payload)) {
98
+        if (!\is_array($payload)) {
99 99
             throw new InvalidArgumentException('Unable to decode token payload');
100 100
         }
101 101
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
         $requiredClaims = [];
122 122
 
123
-        if (! $fromUserInfo) {
123
+        if (!$fromUserInfo) {
124 124
             $requiredClaims = ['iss', 'sub', 'aud', 'exp', 'iat'];
125 125
         }
126 126
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         if (0 === \strpos($expectedAlg, 'HS')) {
147 147
             $clientSecret = $metadata->getClientSecret();
148 148
 
149
-            if (! $clientSecret) {
149
+            if (!$clientSecret) {
150 150
                 throw new RuntimeException('Unable to verify token without client_secret');
151 151
             }
152 152
 
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
         if ($kid) {
161 161
             $jwk = $jwks->selectKey('sig', null, ['kid' => $kid]);
162
-            if (! $jwk) {
162
+            if (!$jwk) {
163 163
                 throw new RuntimeException('Unable to find the jwk with the provided kid: ' . $kid);
164 164
             }
165 165
 
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
             $result = $jwsVerifier->verifyWithKeySet($jws, $jwks, 0);
169 169
         }
170 170
 
171
-        if (! $result) {
171
+        if (!$result) {
172 172
             throw new InvalidArgumentException('Failed to validate JWT signature');
173 173
         }
174 174
 
Please login to merge, or discard this patch.
src/Middleware/UserInfoMiddleware.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,11 +37,11 @@
 block discarded – undo
37 37
         $tokenSet = $request->getAttribute(TokenSetInterface::class);
38 38
         $client = $this->client ?: $request->getAttribute(ClientInterface::class);
39 39
 
40
-        if (! $client instanceof ClientInterface) {
40
+        if (!$client instanceof ClientInterface) {
41 41
             throw new LogicException('No OpenID client provided');
42 42
         }
43 43
 
44
-        if (! $tokenSet instanceof TokenSetInterface) {
44
+        if (!$tokenSet instanceof TokenSetInterface) {
45 45
             throw new RuntimeException('Unable to get token response attribute');
46 46
         }
47 47
 
Please login to merge, or discard this patch.
src/Service/UserinfoService.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
     {
58 58
         $accessToken = $tokenSet->getAccessToken();
59 59
 
60
-        if (! $accessToken) {
60
+        if (!$accessToken) {
61 61
             throw new RuntimeException('Unable to get an access token from the token set');
62 62
         }
63 63
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
             $endpointUri = $issuerMetadata->getMtlsEndpointAliases()['userinfo_endpoint'] ?? $endpointUri;
73 73
         }
74 74
 
75
-        if (! $endpointUri) {
75
+        if (!$endpointUri) {
76 76
             throw new InvalidArgumentException('Invalid issuer userinfo endpoint');
77 77
         }
78 78
 
@@ -101,20 +101,20 @@  discard block
 block discarded – undo
101 101
             $payload = \json_decode((string) $response->getBody(), true);
102 102
         }
103 103
 
104
-        if (! \is_array($payload)) {
104
+        if (!\is_array($payload)) {
105 105
             throw new RuntimeException('Unable to parse userinfo claims');
106 106
         }
107 107
 
108 108
         $idToken = $tokenSet->getIdToken();
109 109
 
110
-        if (! $idToken) {
110
+        if (!$idToken) {
111 111
             return $payload;
112 112
         }
113 113
 
114 114
         // check expected sub
115 115
         $expectedSub = $tokenSet->claims()['sub'] ?? null;
116 116
 
117
-        if (! $expectedSub) {
117
+        if (!$expectedSub) {
118 118
             throw new RuntimeException('Unable to get sub claim from id_token');
119 119
         }
120 120
 
Please login to merge, or discard this patch.
src/Provider/IssuerMetadataProvider.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
                 : $resource
56 56
         );
57 57
 
58
-        if (! \is_array($parsedUrl) || ! \array_key_exists('host', $parsedUrl)) {
58
+        if (!\is_array($parsedUrl) || !\array_key_exists('host', $parsedUrl)) {
59 59
             throw new RuntimeException('Unable to parse resource');
60 60
         }
61 61
 
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         $links = $data['links'] ?? [];
80 80
         $href = null;
81 81
         foreach ($links as $link) {
82
-            if (! \is_array($link)) {
82
+            if (!\is_array($link)) {
83 83
                 continue;
84 84
             }
85 85
 
@@ -87,14 +87,14 @@  discard block
 block discarded – undo
87 87
                 continue;
88 88
             }
89 89
 
90
-            if (! \array_key_exists('href', $link)) {
90
+            if (!\array_key_exists('href', $link)) {
91 91
                 continue;
92 92
             }
93 93
 
94 94
             $href = $link['href'];
95 95
         }
96 96
 
97
-        if (! \is_string($href) || 0 !== \strpos($href, 'https://')) {
97
+        if (!\is_string($href) || 0 !== \strpos($href, 'https://')) {
98 98
             throw new InvalidArgumentException('Invalid issuer location');
99 99
         }
100 100
 
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             throw new RuntimeException('Unable to fetch provider metadata', 0, $e);
145 145
         }
146 146
 
147
-        if (! \array_key_exists('issuer', $data)) {
147
+        if (!\array_key_exists('issuer', $data)) {
148 148
             throw new RuntimeException('Invalid metadata content, no "issuer" key found');
149 149
         }
150 150
 
Please login to merge, or discard this patch.
src/functions/normalize_webfinger.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
  */
12 12
 function normalize_webfinger(string $input): string
13 13
 {
14
-    $hasScheme = static function (string $resource): bool {
14
+    $hasScheme = static function(string $resource): bool {
15 15
         if (false !== \strpos($resource, '://')) {
16 16
             return true;
17 17
         }
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
 
25 25
         $hostOrPort = \substr($resource, $index + 1);
26 26
 
27
-        return ! \preg_match('/^\d+$/', $hostOrPort);
27
+        return !\preg_match('/^\d+$/', $hostOrPort);
28 28
     };
29 29
 
30
-    $acctSchemeAssumed = static function (string $input): bool {
30
+    $acctSchemeAssumed = static function(string $input): bool {
31 31
         if (false === \strpos($input, '@')) {
32 32
             return false;
33 33
         }
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
         /** @var string $host */
37 37
         $host = \array_pop($parts);
38 38
 
39
-        return ! \preg_match('/[:\/?]+/', $host);
39
+        return !\preg_match('/[:\/?]+/', $host);
40 40
     };
41 41
 
42 42
     if ($hasScheme($input)) {
Please login to merge, or discard this patch.
src/Service/ClientRegistrationService.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     ): array {
53 53
         $registrationEndpoint = $issuer->getMetadata()->getRegistrationEndpoint();
54 54
 
55
-        if (! $registrationEndpoint) {
55
+        if (!$registrationEndpoint) {
56 56
             throw new InvalidArgumentException('Issuer does not support dynamic client registration');
57 57
         }
58 58
 
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 
81 81
         $data = parse_metadata_response($response, 201);
82 82
 
83
-        if (! \array_key_exists('client_id', $data)) {
83
+        if (!\array_key_exists('client_id', $data)) {
84 84
             throw new RuntimeException('Registration response did not return a client_id field');
85 85
         }
86 86
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 
102 102
         $claims = parse_metadata_response($response, 200);
103 103
 
104
-        if (! \array_key_exists('client_id', $claims)) {
104
+        if (!\array_key_exists('client_id', $claims)) {
105 105
             throw new RuntimeException('Registration response did not return a client_id field');
106 106
         }
107 107
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
         $data = parse_metadata_response($response, 200);
141 141
 
142
-        if (! \array_key_exists('client_id', $data)) {
142
+        if (!\array_key_exists('client_id', $data)) {
143 143
             throw new RuntimeException('Registration response did not return a client_id field');
144 144
         }
145 145
 
Please login to merge, or discard this patch.
src/functions/parse_callback_params.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
     if ('POST' === $method) {
20 20
         \parse_str((string) $serverRequest->getBody(), $params);
21 21
 
22
-        if (! \is_array($params)) {
22
+        if (!\is_array($params)) {
23 23
             throw new RuntimeException('Invalid parsed body');
24 24
         }
25 25
 
Please login to merge, or discard this patch.