Passed
Push — master ( a8b319...575510 )
by Hergen
12:36 queued 08:46
created
src/JwtAuthRoles.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 {
16 16
     private static function getKid(string $jwt): ?string
17 17
     {
18
-        if (! Str::is('*.*.*', $jwt)) {
18
+        if (!Str::is('*.*.*', $jwt)) {
19 19
             throw AuthException::auth(422, 'Malformed JWT');
20 20
         }
21 21
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
     private static function getClaims(string $jwt): ?object
32 32
     {
33
-        if (! Str::is('*.*.*', $jwt)) {
33
+        if (!Str::is('*.*.*', $jwt)) {
34 34
             throw AuthException::auth(422, 'Malformed JWT');
35 35
         }
36 36
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
     private static function jwkToPem(object $jwk): ?string
44 44
     {
45
-        if (! isset($jwk->e) || ! isset($jwk->n)) {
45
+        if (!isset($jwk->e) || !isset($jwk->n)) {
46 46
             throw AuthException::auth(500, 'Malformed jwk');
47 47
         }
48 48
 
@@ -59,13 +59,13 @@  discard block
 block discarded – undo
59 59
     {
60 60
         $response = Http::get($uri);
61 61
         $json = $response->getBody();
62
-        if (! $json) {
62
+        if (!$json) {
63 63
             throw AuthException::auth(404, 'jwks endpoint not found');
64 64
         }
65 65
 
66 66
         $jwks = json_decode($json, false);
67 67
 
68
-        if (! $jwks || ! isset($jwks->keys) || ! is_array($jwks->keys)) {
68
+        if (!$jwks || !isset($jwks->keys) || !is_array($jwks->keys)) {
69 69
             throw AuthException::auth(404, 'No JWKs found');
70 70
         }
71 71
 
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
     {
83 83
         $response = Http::get($uri);
84 84
         $json = $response->getBody();
85
-        if (! $json) {
85
+        if (!$json) {
86 86
             throw AuthException::auth(404, 'pem endpoint not found');
87 87
         }
88 88
 
89 89
         $pems = json_decode($json, false);
90 90
 
91
-        if (! $pems || ! isset($pems->publicKeys) || ! is_object($pems->publicKeys)) {
91
+        if (!$pems || !isset($pems->publicKeys) || !is_object($pems->publicKeys)) {
92 92
             throw AuthException::auth(404, 'pem not found');
93 93
         }
94 94
 
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
     private static function verifyToken(string $jwt, string $uri, bool $jwk = false): object
105 105
     {
106 106
         $kid = self::getKid($jwt);
107
-        if (! $kid) {
107
+        if (!$kid) {
108 108
             throw AuthException::auth(422, 'Malformed JWT');
109 109
         }
110 110
         if (config('jwtauthroles.cache.enabled')) {
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                 ? self::getJwk($kid, $uri)
121 121
                 : self::getPem($kid, $uri);
122 122
 
123
-        if (! isset($publicKey) || ! $publicKey) {
123
+        if (!isset($publicKey) || !$publicKey) {
124 124
             throw AuthException::auth(500, 'Unable to validate JWT');
125 125
         }
126 126
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
             ? config('jwtauthroles.jwkUri')
142 142
             : config('jwtauthroles.pemUri');
143 143
 
144
-        if (! config('jwtauthroles.validateJwt')) {
144
+        if (!config('jwtauthroles.validateJwt')) {
145 145
             $claims = self::getClaims($jwt);
146 146
         } else {
147 147
             $claims = self::verifyToken($jwt, $uri, config('jwtauthroles.useJwk'));
Please login to merge, or discard this patch.