GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 356550...41f07f )
by sebastian
03:01
created
src/jws/impl/JWS.php 1 patch
Braces   +42 added lines, -32 removed lines patch added patch discarded remove patch
@@ -79,8 +79,9 @@  discard block
 block discarded – undo
79 79
 
80 80
         parent::__construct($header, $claim_set);
81 81
 
82
-        if(!is_null($payload))
83
-            $this->setPayload($payload);
82
+        if(!is_null($payload)) {
83
+                    $this->setPayload($payload);
84
+        }
84 85
 
85 86
         $this->signature = $signature;
86 87
     }
@@ -100,8 +101,9 @@  discard block
 block discarded – undo
100 101
      */
101 102
     public function toCompactSerialization()
102 103
     {
103
-        if(!is_null($this->jwk->getId()))
104
-            $this->header->addHeader(new JOSEHeaderParam(RegisteredJOSEHeaderNames::KeyID, $this->jwk->getId()));
104
+        if(!is_null($this->jwk->getId())) {
105
+                    $this->header->addHeader(new JOSEHeaderParam(RegisteredJOSEHeaderNames::KeyID, $this->jwk->getId()));
106
+        }
105 107
 
106 108
         if($this->jwk instanceof IAsymmetricJWK)
107 109
         {
@@ -134,16 +136,19 @@  discard block
 block discarded – undo
134 136
     public function sign()
135 137
     {
136 138
 
137
-        if(is_null($this->jwk))
138
-            throw new JWSInvalidJWKException;
139
+        if(is_null($this->jwk)) {
140
+                    throw new JWSInvalidJWKException;
141
+        }
139 142
 
140
-        if($this->jwk->getKeyUse()->getString() !== JSONWebKeyPublicKeyUseValues::Signature)
141
-            throw new JWSInvalidJWKException(sprintf('use %s not supported.', $this->jwk->getKeyUse()->getString()));
143
+        if($this->jwk->getKeyUse()->getString() !== JSONWebKeyPublicKeyUseValues::Signature) {
144
+                    throw new JWSInvalidJWKException(sprintf('use %s not supported.', $this->jwk->getKeyUse()->getString()));
145
+        }
142 146
 
143 147
         $alg = DigitalSignatures_MACs_Registry::getInstance()->get($this->header->getAlgorithm()->getString());
144 148
 
145
-        if(is_null($alg))
146
-            throw new JWSNotSupportedAlgorithm(sprintf('alg %s.',$this->header->getAlgorithm()->getString()));
149
+        if(is_null($alg)) {
150
+                    throw new JWSNotSupportedAlgorithm(sprintf('alg %s.',$this->header->getAlgorithm()->getString()));
151
+        }
147 152
 
148 153
         $secured_input_bytes = JOSEHeaderSerializer::serialize($this->header) . IBasicJWT::SegmentSeparator .$this->getEncodedPayload();
149 154
 
@@ -152,12 +157,10 @@  discard block
 block discarded – undo
152 157
         if($alg instanceof DigitalSignatureAlgorithm)
153 158
         {
154 159
             $this->signature = $alg->sign($key, $secured_input_bytes);
155
-        }
156
-        else if($alg instanceof MAC_Algorithm )
160
+        } else if($alg instanceof MAC_Algorithm )
157 161
         {
158 162
             $this->signature = $alg->digest($key, $secured_input_bytes);
159
-        }
160
-        else
163
+        } else
161 164
         {
162 165
             throw new JWSNotSupportedAlgorithm(sprintf('alg %s.',$this->header->getAlgorithm()->getString()));
163 166
         }
@@ -171,16 +174,16 @@  discard block
 block discarded – undo
171 174
      */
172 175
     public function getEncodedPayload()
173 176
     {
174
-        if(is_null($this->payload))
175
-            throw new JWSInvalidPayloadException('payload is not set!');
177
+        if(is_null($this->payload)) {
178
+                    throw new JWSInvalidPayloadException('payload is not set!');
179
+        }
176 180
 
177 181
         $enc_payload = '';
178 182
 
179 183
         if($this->payload instanceof IJWSPayloadClaimSetSpec)
180 184
         {
181 185
             $enc_payload = JWTClaimSetSerializer::serialize($this->payload->getClaimSet());
182
-        }
183
-        else if($this->payload instanceof IJWSPayloadRawSpec)
186
+        } else if($this->payload instanceof IJWSPayloadRawSpec)
184 187
         {
185 188
             $enc_payload = JWTRawSerializer::serialize($this->payload->getRaw());
186 189
         }
@@ -234,11 +237,12 @@  discard block
 block discarded – undo
234 237
      */
235 238
     public function verify($original_alg)
236 239
     {
237
-        if(is_null($this->jwk))
238
-            throw new JWSInvalidJWKException;
240
+        if(is_null($this->jwk)) {
241
+                    throw new JWSInvalidJWKException;
242
+        }
239 243
 
240
-        if($this->jwk->getKeyUse()->getString() !== JSONWebKeyPublicKeyUseValues::Signature)
241
-            throw new JWSInvalidJWKException
244
+        if($this->jwk->getKeyUse()->getString() !== JSONWebKeyPublicKeyUseValues::Signature) {
245
+                    throw new JWSInvalidJWKException
242 246
             (
243 247
                 sprintf
244 248
                 (
@@ -246,12 +250,14 @@  discard block
 block discarded – undo
246 250
                     $this->jwk->getKeyUse()->getString()
247 251
                 )
248 252
             );
253
+        }
249 254
 
250
-        if(is_null($this->jwk->getAlgorithm()))
251
-            throw new InvalidJWKAlgorithm('algorithm intended for use with the key is not set! ');
255
+        if(is_null($this->jwk->getAlgorithm())) {
256
+                    throw new InvalidJWKAlgorithm('algorithm intended for use with the key is not set! ');
257
+        }
252 258
 
253
-        if(!is_null($this->jwk->getId()) && !is_null($this->header->getKeyID()) && $this->header->getKeyID()->getValue() != $this->jwk->getId()->getValue())
254
-            throw new JWSInvalidJWKException
259
+        if(!is_null($this->jwk->getId()) && !is_null($this->header->getKeyID()) && $this->header->getKeyID()->getValue() != $this->jwk->getId()->getValue()) {
260
+                    throw new JWSInvalidJWKException
255 261
             (
256 262
                 sprintf
257 263
                 (
@@ -260,16 +266,18 @@  discard block
 block discarded – undo
260 266
                     $this->jwk->getId()->getValue()
261 267
                 )
262 268
             );
269
+        }
263 270
 
264 271
         $alg = DigitalSignatures_MACs_Registry::getInstance()->get($original_alg);
265 272
 
266
-        if(is_null($alg))
267
-            throw new JWSNotSupportedAlgorithm(sprintf('algo %s', $original_alg));
273
+        if(is_null($alg)) {
274
+                    throw new JWSNotSupportedAlgorithm(sprintf('algo %s', $original_alg));
275
+        }
268 276
 
269 277
         $former_alg = $this->header->getAlgorithm()->getString();
270 278
 
271
-        if($former_alg != $original_alg)
272
-            throw new JWSNotSupportedAlgorithm
279
+        if($former_alg != $original_alg) {
280
+                    throw new JWSNotSupportedAlgorithm
273 281
             (
274 282
                 sprintf
275 283
                 (
@@ -278,9 +286,10 @@  discard block
 block discarded – undo
278 286
                     $original_alg
279 287
                 )
280 288
             );
289
+        }
281 290
 
282
-        if($this->jwk->getAlgorithm()->getValue() !==  $original_alg)
283
-            throw new InvalidJWKAlgorithm
291
+        if($this->jwk->getAlgorithm()->getValue() !==  $original_alg) {
292
+                    throw new InvalidJWKAlgorithm
284 293
             (
285 294
                 sprintf
286 295
                 (
@@ -289,6 +298,7 @@  discard block
 block discarded – undo
289 298
                     $original_alg
290 299
                 )
291 300
             );
301
+        }
292 302
 
293 303
         $secured_input_bytes = JOSEHeaderSerializer::serialize($this->header) . IBasicJWT::SegmentSeparator .$this->getEncodedPayload();
294 304
 
Please login to merge, or discard this patch.