Completed
Push — master ( 8bbc6f...d6db6c )
by Thijs
02:45
created
src/SAML2/Certificate/KeyLoader.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
      * are not configured to be used with the usage given
77 77
      *
78 78
      * @param array $configuredKeys
79
-     * @param       $usage
79
+     * @param       null|string $usage
80 80
      */
81 81
     public function loadKeys(array $configuredKeys, $usage)
82 82
     {
Please login to merge, or discard this patch.
src/SAML2/Utils.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -248,7 +248,7 @@
 block discarded – undo
248 248
      *
249 249
      * @param  DOMElement $node          The element we should fetch the attribute from.
250 250
      * @param  string     $attributeName The name of the attribute.
251
-     * @param  mixed      $default       The value that should be returned if the attribute doesn't exist.
251
+     * @param  false|null      $default       The value that should be returned if the attribute doesn't exist.
252 252
      * @return bool|mixed The value of the attribute, or $default if the attribute doesn't exist.
253 253
      * @throws Exception
254 254
      */
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -493,7 +493,7 @@
 block discarded – undo
493 493
          * namespaces needed to parse the XML.
494 494
          */
495 495
         $xml = '<root xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" '.
496
-                     'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' .
496
+                        'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' .
497 497
             $decrypted .
498 498
             '</root>';
499 499
 
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         }
247 247
 
248 248
         foreach ($namespaces as $prefix => $uri) {
249
-            $newElement->setAttributeNS($uri, $prefix . ':__ns_workaround__', 'tmp');
249
+            $newElement->setAttributeNS($uri, $prefix.':__ns_workaround__', 'tmp');
250 250
             $newElement->removeAttributeNS($uri, '__ns_workaround__');
251 251
         }
252 252
 
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
             case 'true':
280 280
                 return true;
281 281
             default:
282
-                throw new \Exception('Invalid value of boolean attribute ' . var_export($attributeName, true) . ': ' . var_export($value, true));
282
+                throw new \Exception('Invalid value of boolean attribute '.var_export($attributeName, true).': '.var_export($value, true));
283 283
         }
284 284
     }
285 285
 
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
             $symKeyInfoAlgo = $symmetricKeyInfo->getAlgorith();
416 416
 
417 417
             if (in_array($symKeyInfoAlgo, $blacklist, true)) {
418
-                throw new \Exception('Algorithm disabled: ' . var_export($symKeyInfoAlgo, true));
418
+                throw new \Exception('Algorithm disabled: '.var_export($symKeyInfoAlgo, true));
419 419
             }
420 420
 
421 421
             if ($symKeyInfoAlgo === XMLSecurityKey::RSA_OAEP_MGF1P && $inputKeyAlgo === XMLSecurityKey::RSA_1_5) {
@@ -431,9 +431,9 @@  discard block
 block discarded – undo
431 431
             /* Make sure that the input key format is the same as the one used to encrypt the key. */
432 432
             if ($inputKeyAlgo !== $symKeyInfoAlgo) {
433 433
                 throw new \Exception(
434
-                    'Algorithm mismatch between input key and key used to encrypt ' .
435
-                    ' the symmetric key for the message. Key was: ' .
436
-                    var_export($inputKeyAlgo, true) . '; message was: ' .
434
+                    'Algorithm mismatch between input key and key used to encrypt '.
435
+                    ' the symmetric key for the message. Key was: '.
436
+                    var_export($inputKeyAlgo, true).'; message was: '.
437 437
                     var_export($symKeyInfoAlgo, true)
438 438
                 );
439 439
             }
@@ -447,20 +447,20 @@  discard block
 block discarded – undo
447 447
                 /* To protect against "key oracle" attacks, we need to be able to create a
448 448
                  * symmetric key, and for that we need to know the key size.
449 449
                  */
450
-                throw new \Exception('Unknown key size for encryption algorithm: ' . var_export($symmetricKey->type, true));
450
+                throw new \Exception('Unknown key size for encryption algorithm: '.var_export($symmetricKey->type, true));
451 451
             }
452 452
 
453 453
             try {
454 454
                 $key = $encKey->decryptKey($symmetricKeyInfo);
455 455
                 if (strlen($key) != $keySize) {
456 456
                     throw new \Exception(
457
-                        'Unexpected key size (' . strlen($key) * 8 . 'bits) for encryption algorithm: ' .
457
+                        'Unexpected key size ('.strlen($key)*8.'bits) for encryption algorithm: '.
458 458
                         var_export($symmetricKey->type, true)
459 459
                     );
460 460
                 }
461 461
             } catch (\Exception $e) {
462 462
                 /* We failed to decrypt this key. Log it, and substitute a "random" key. */
463
-                Utils::getContainer()->getLogger()->error('Failed to decrypt symmetric key: ' . $e->getMessage());
463
+                Utils::getContainer()->getLogger()->error('Failed to decrypt symmetric key: '.$e->getMessage());
464 464
                 /* Create a replacement key, so that it looks like we fail in the same way as if the key was correctly padded. */
465 465
 
466 466
                 /* We base the symmetric key on the encrypted key and private key, so that we always behave the
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
                 $encryptedKey = $encKey->getCipherValue();
470 470
                 $pkey = openssl_pkey_get_details($symmetricKeyInfo->key);
471 471
                 $pkey = sha1(serialize($pkey), true);
472
-                $key = sha1($encryptedKey . $pkey, true);
472
+                $key = sha1($encryptedKey.$pkey, true);
473 473
 
474 474
                 /* Make sure that the key has the correct length. */
475 475
                 if (strlen($key) > $keySize) {
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
             /* Make sure that the input key has the correct format. */
485 485
             if ($inputKeyAlgo !== $symKeyAlgo) {
486 486
                 throw new \Exception(
487
-                    'Algorithm mismatch between input key and key in message. ' .
488
-                    'Key was: ' . var_export($inputKeyAlgo, true) . '; message was: ' .
487
+                    'Algorithm mismatch between input key and key in message. '.
488
+                    'Key was: '.var_export($inputKeyAlgo, true).'; message was: '.
489 489
                     var_export($symKeyAlgo, true)
490 490
                 );
491 491
             }
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 
495 495
         $algorithm = $symmetricKey->getAlgorith();
496 496
         if (in_array($algorithm, $blacklist, true)) {
497
-            throw new \Exception('Algorithm disabled: ' . var_export($algorithm, true));
497
+            throw new \Exception('Algorithm disabled: '.var_export($algorithm, true));
498 498
         }
499 499
 
500 500
         /** @var string $decrypted */
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
          * namespaces needed to parse the XML.
507 507
          */
508 508
         $xml = '<root xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" '.
509
-                     'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' .
510
-            $decrypted .
509
+                     'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.
510
+            $decrypted.
511 511
             '</root>';
512 512
 
513 513
         try {
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
              * Something went wrong during decryption, but for security
547 547
              * reasons we cannot tell the user what failed.
548 548
              */
549
-            Utils::getContainer()->getLogger()->error('Decryption failed: ' . $e->getMessage());
549
+            Utils::getContainer()->getLogger()->error('Decryption failed: '.$e->getMessage());
550 550
             throw new \Exception('Failed to decrypt XML element.', 0, $e);
551 551
         }
552 552
     }
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
         $regex = '/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.\\d+)?Z$/D';
709 709
         if (preg_match($regex, $time, $matches) == 0) {
710 710
             throw new \Exception(
711
-                'Invalid SAML2 timestamp passed to xsDateTimeToTimestamp: ' . $time
711
+                'Invalid SAML2 timestamp passed to xsDateTimeToTimestamp: '.$time
712 712
             );
713 713
         }
714 714
 
Please login to merge, or discard this patch.
src/SAML2/XML/mdui/Keywords.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
             if (strpos($keyword, "+") !== FALSE) {
69 69
                 throw new Exception('Keywords may not contain a "+" character.');
70 70
             }
71
-            $value .= str_replace(' ', '+', $keyword) . ' ';
71
+            $value .= str_replace(' ', '+', $keyword).' ';
72 72
         }
73 73
         $value = rtrim($value);
74 74
         $e->appendChild($doc->createTextNode($value));
Please login to merge, or discard this patch.
src/SAML2/SignedElementHelper.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -173,8 +173,8 @@
 block discarded – undo
173 173
         foreach ($this->certificates as $cert) {
174 174
 
175 175
             /* We have found a matching fingerprint. */
176
-            $pemCert = "-----BEGIN CERTIFICATE-----\n" .
177
-                chunk_split($cert, 64) .
176
+            $pemCert = "-----BEGIN CERTIFICATE-----\n".
177
+                chunk_split($cert, 64).
178 178
                 "-----END CERTIFICATE-----\n";
179 179
 
180 180
             /* Extract the public key from the certificate for validation. */
Please login to merge, or discard this patch.
src/SAML2/Response/Validation/ConstraintValidator/IsSuccessful.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,8 +22,8 @@
 block discarded – undo
22 22
         return sprintf(
23 23
             '%s%s%s',
24 24
             $this->truncateStatus($responseStatus['Code']),
25
-            $responseStatus['SubCode'] ? '/' . $this->truncateStatus($responseStatus['SubCode']) : '',
26
-            $responseStatus['Message'] ? ' ' . $responseStatus['Message'] : ''
25
+            $responseStatus['SubCode'] ? '/'.$this->truncateStatus($responseStatus['SubCode']) : '',
26
+            $responseStatus['Message'] ? ' '.$responseStatus['Message'] : ''
27 27
         );
28 28
     }
29 29
 
Please login to merge, or discard this patch.
src/SAML2/Assertion.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -62,11 +62,11 @@
 block discarded – undo
62 62
      */
63 63
     private $encryptionKey;
64 64
 
65
-     /**
66
-     * The earliest time this assertion is valid, as an UNIX timestamp.
67
-     *
68
-     * @var int
69
-     */
65
+        /**
66
+         * The earliest time this assertion is valid, as an UNIX timestamp.
67
+         *
68
+         * @var int
69
+         */
70 70
     private $notBefore;
71 71
 
72 72
     /**
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 
247 247
         if ($xml->getAttribute('Version') !== '2.0') {
248 248
             /* Currently a very strict check. */
249
-            throw new \Exception('Unsupported version: ' . $xml->getAttribute('Version'));
249
+            throw new \Exception('Unsupported version: '.$xml->getAttribute('Version'));
250 250
         }
251 251
 
252 252
         $this->issueInstant = Utils::xsDateTimeToTimestamp($xml->getAttribute('IssueInstant'));
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
                 continue;
347 347
             }
348 348
             if ($node->namespaceURI !== Constants::NS_SAML) {
349
-                throw new \Exception('Unknown namespace of condition: ' . var_export($node->namespaceURI, true));
349
+                throw new \Exception('Unknown namespace of condition: '.var_export($node->namespaceURI, true));
350 350
             }
351 351
             switch ($node->localName) {
352 352
                 case 'AudienceRestriction':
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
                     /* Currently ignored. */
370 370
                     break;
371 371
                 default:
372
-                    throw new \Exception('Unknown condition: ' . var_export($node->localName, true));
372
+                    throw new \Exception('Unknown condition: '.var_export($node->localName, true));
373 373
             }
374 374
         }
375 375
     }
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 
531 531
             $type = $value->getAttribute('xsi:type');
532 532
             if ($type === 'xs:integer') {
533
-                $this->attributes[$attributeName][] = (int)$value->textContent;
533
+                $this->attributes[$attributeName][] = (int) $value->textContent;
534 534
             } else {
535 535
                 $this->attributes[$attributeName][] = trim($value->textContent);
536 536
             }
@@ -1287,7 +1287,7 @@  discard block
 block discarded – undo
1287 1287
             $document = $parentElement->ownerDocument;
1288 1288
         }
1289 1289
 
1290
-        $root = $document->createElementNS(Constants::NS_SAML, 'saml:' . 'Assertion');
1290
+        $root = $document->createElementNS(Constants::NS_SAML, 'saml:'.'Assertion');
1291 1291
         $parentElement->appendChild($root);
1292 1292
 
1293 1293
         /* Ugly hack to add another namespace declaration to the root element. */
@@ -1339,7 +1339,7 @@  discard block
 block discarded – undo
1339 1339
         if ($this->encryptedNameId === null) {
1340 1340
             Utils::addNameId($subject, $this->nameId);
1341 1341
         } else {
1342
-            $eid = $subject->ownerDocument->createElementNS(Constants::NS_SAML, 'saml:' . 'EncryptedID');
1342
+            $eid = $subject->ownerDocument->createElementNS(Constants::NS_SAML, 'saml:'.'EncryptedID');
1343 1343
             $subject->appendChild($eid);
1344 1344
             $eid->appendChild($subject->ownerDocument->importNode($this->encryptedNameId, true));
1345 1345
         }
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
     /**
695 695
      * Check whether the NameId is encrypted.
696 696
      *
697
-     * @return true if the NameId is encrypted, false if not.
697
+     * @return boolean if the NameId is encrypted, false if not.
698 698
      */
699 699
     public function isNameIdEncrypted()
700 700
     {
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
      *
1097 1097
      * The URI reference MAY directly resolve into an XML document containing the referenced declaration.
1098 1098
      *
1099
-     * @return string
1099
+     * @return Chunk
1100 1100
      */
1101 1101
     public function getAuthnContextDeclRef()
1102 1102
     {
Please login to merge, or discard this patch.
src/SAML2/Configuration/SimpleSAMLConverter.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -51,25 +51,25 @@
 block discarded – undo
51 51
 
52 52
         // ported from
53 53
         // https://github.com/simplesamlphp/simplesamlphp/blob/3d735912342767d391297cc5e13272a76730aca0/lib/SimpleSAML/Configuration.php#L1092
54
-        if ($configuration->hasValue($prefix . 'keys')) {
55
-            $extracted['keys'] = $configuration->getArray($prefix . 'keys');
54
+        if ($configuration->hasValue($prefix.'keys')) {
55
+            $extracted['keys'] = $configuration->getArray($prefix.'keys');
56 56
         }
57 57
 
58 58
         // ported from
59 59
         // https://github.com/simplesamlphp/simplesamlphp/blob/3d735912342767d391297cc5e13272a76730aca0/lib/SimpleSAML/Configuration.php#L1108
60
-        if ($configuration->hasValue($prefix . 'certData')) {
61
-            $extracted['certificateData'] = $configuration->getString($prefix . 'certData');
60
+        if ($configuration->hasValue($prefix.'certData')) {
61
+            $extracted['certificateData'] = $configuration->getString($prefix.'certData');
62 62
         }
63 63
 
64 64
         // ported from
65 65
         // https://github.com/simplesamlphp/simplesamlphp/blob/3d735912342767d391297cc5e13272a76730aca0/lib/SimpleSAML/Configuration.php#L1119
66
-        if ($configuration->hasValue($prefix . 'certificate')) {
67
-            $extracted['certificateData'] = $configuration->getString($prefix . 'certificate');
66
+        if ($configuration->hasValue($prefix.'certificate')) {
67
+            $extracted['certificateData'] = $configuration->getString($prefix.'certificate');
68 68
         }
69 69
 
70 70
         // ported from
71 71
         // https://github.com/simplesamlphp/simplesamlphp/blob/3d735912342767d391297cc5e13272a76730aca0/modules/saml/lib/Message.php#L161
72
-        if ($configuration->hasValue($prefix . 'certFingerprint')) {
72
+        if ($configuration->hasValue($prefix.'certFingerprint')) {
73 73
             $extracted['certificateFingerprint'] = $configuration->getArrayizeString('certFingerprint');
74 74
         }
75 75
 
Please login to merge, or discard this patch.
src/SAML2/Signature/ValidatorChain.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
 
69 69
         throw new SAML2_Signature_MissingConfigurationException(sprintf(
70 70
             'No certificates or fingerprints have been configured%s',
71
-            $configuration->has('entityid') ? ' for "' . $configuration->get('entityid') . '"' : ''
71
+            $configuration->has('entityid') ? ' for "'.$configuration->get('entityid').'"' : ''
72 72
         ));
73 73
     }
74 74
 }
Please login to merge, or discard this patch.
src/SAML2/Signature/FingerprintValidator.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
         SAML2_SignedElement $signedElement,
58 58
         SAML2_Configuration_CertificateProvider $configuration
59 59
     ) {
60
-        $this->certificates = array_map(function ($certificate) {
60
+        $this->certificates = array_map(function($certificate) {
61 61
             return SAML2_Certificate_X509::createFromCertificateData($certificate);
62 62
         }, $this->certificates);
63 63
 
Please login to merge, or discard this patch.