Completed
Branch gettersetter (94d61b)
by Tim
02:24
created
src/SAML2/Utils.php 3 patches
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
 
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
423 423
             $symKeyInfoAlgo = $symmetricKeyInfo->getAlgorithm();
424 424
 
425 425
             if (in_array($symKeyInfoAlgo, $blacklist, true)) {
426
-                throw new \Exception('Algorithm disabled: ' . var_export($symKeyInfoAlgo, true));
426
+                throw new \Exception('Algorithm disabled: '.var_export($symKeyInfoAlgo, true));
427 427
             }
428 428
 
429 429
             if ($symKeyInfoAlgo === XMLSecurityKey::RSA_OAEP_MGF1P && $inputKeyAlgo === XMLSecurityKey::RSA_1_5) {
@@ -439,9 +439,9 @@  discard block
 block discarded – undo
439 439
             /* Make sure that the input key format is the same as the one used to encrypt the key. */
440 440
             if ($inputKeyAlgo !== $symKeyInfoAlgo) {
441 441
                 throw new \Exception(
442
-                    'Algorithm mismatch between input key and key used to encrypt ' .
443
-                    ' the symmetric key for the message. Key was: ' .
444
-                    var_export($inputKeyAlgo, true) . '; message was: ' .
442
+                    'Algorithm mismatch between input key and key used to encrypt '.
443
+                    ' the symmetric key for the message. Key was: '.
444
+                    var_export($inputKeyAlgo, true).'; message was: '.
445 445
                     var_export($symKeyInfoAlgo, true)
446 446
                 );
447 447
             }
@@ -455,20 +455,20 @@  discard block
 block discarded – undo
455 455
                 /* To protect against "key oracle" attacks, we need to be able to create a
456 456
                  * symmetric key, and for that we need to know the key size.
457 457
                  */
458
-                throw new \Exception('Unknown key size for encryption algorithm: ' . var_export($symmetricKey->type, true));
458
+                throw new \Exception('Unknown key size for encryption algorithm: '.var_export($symmetricKey->type, true));
459 459
             }
460 460
 
461 461
             try {
462 462
                 $key = $encKey->decryptKey($symmetricKeyInfo);
463 463
                 if (strlen($key) != $keySize) {
464 464
                     throw new \Exception(
465
-                        'Unexpected key size (' . strlen($key) * 8 . 'bits) for encryption algorithm: ' .
465
+                        'Unexpected key size ('.strlen($key)*8.'bits) for encryption algorithm: '.
466 466
                         var_export($symmetricKey->type, true)
467 467
                     );
468 468
                 }
469 469
             } catch (\Exception $e) {
470 470
                 /* We failed to decrypt this key. Log it, and substitute a "random" key. */
471
-                Utils::getContainer()->getLogger()->error('Failed to decrypt symmetric key: ' . $e->getMessage());
471
+                Utils::getContainer()->getLogger()->error('Failed to decrypt symmetric key: '.$e->getMessage());
472 472
                 /* Create a replacement key, so that it looks like we fail in the same way as if the key was correctly padded. */
473 473
 
474 474
                 /* We base the symmetric key on the encrypted key and private key, so that we always behave the
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
                 $encryptedKey = $encKey->getCipherValue();
478 478
                 $pkey = openssl_pkey_get_details($symmetricKeyInfo->key);
479 479
                 $pkey = sha1(serialize($pkey), true);
480
-                $key = sha1($encryptedKey . $pkey, true);
480
+                $key = sha1($encryptedKey.$pkey, true);
481 481
 
482 482
                 /* Make sure that the key has the correct length. */
483 483
                 if (strlen($key) > $keySize) {
@@ -492,8 +492,8 @@  discard block
 block discarded – undo
492 492
             /* Make sure that the input key has the correct format. */
493 493
             if ($inputKeyAlgo !== $symKeyAlgo) {
494 494
                 throw new \Exception(
495
-                    'Algorithm mismatch between input key and key in message. ' .
496
-                    'Key was: ' . var_export($inputKeyAlgo, true) . '; message was: ' .
495
+                    'Algorithm mismatch between input key and key in message. '.
496
+                    'Key was: '.var_export($inputKeyAlgo, true).'; message was: '.
497 497
                     var_export($symKeyAlgo, true)
498 498
                 );
499 499
             }
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 
503 503
         $algorithm = $symmetricKey->getAlgorithm();
504 504
         if (in_array($algorithm, $blacklist, true)) {
505
-            throw new \Exception('Algorithm disabled: ' . var_export($algorithm, true));
505
+            throw new \Exception('Algorithm disabled: '.var_export($algorithm, true));
506 506
         }
507 507
 
508 508
         /** @var string $decrypted */
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
          * namespaces needed to parse the XML.
515 515
          */
516 516
         $xml = '<root xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" '.
517
-                     'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">' .
518
-            $decrypted .
517
+                     'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">'.
518
+            $decrypted.
519 519
             '</root>';
520 520
 
521 521
         try {
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
              * Something went wrong during decryption, but for security
555 555
              * reasons we cannot tell the user what failed.
556 556
              */
557
-            Utils::getContainer()->getLogger()->error('Decryption failed: ' . $e->getMessage());
557
+            Utils::getContainer()->getLogger()->error('Decryption failed: '.$e->getMessage());
558 558
             throw new \Exception('Failed to decrypt XML element.', 0, $e);
559 559
         }
560 560
     }
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
         $regex = '/^(\\d\\d\\d\\d)-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d):(\\d\\d)(?:\\.\\d{1,9})?Z$/D';
717 717
         if (preg_match($regex, $time, $matches) == 0) {
718 718
             throw new \Exception(
719
-                'Invalid SAML2 timestamp passed to xsDateTimeToTimestamp: ' . $time
719
+                'Invalid SAML2 timestamp passed to xsDateTimeToTimestamp: '.$time
720 720
             );
721 721
         }
722 722
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -269,8 +269,8 @@
 block discarded – undo
269 269
      *
270 270
      * @param  \DOMElement $node          The element we should fetch the attribute from.
271 271
      * @param  string     $attributeName The name of the attribute.
272
-     * @param  mixed      $default       The value that should be returned if the attribute doesn't exist.
273
-     * @return bool|mixed The value of the attribute, or $default if the attribute doesn't exist.
272
+     * @param  false|null      $default       The value that should be returned if the attribute doesn't exist.
273
+     * @return boolean|null The value of the attribute, or $default if the attribute doesn't exist.
274 274
      * @throws \Exception
275 275
      */
276 276
     public static function parseBoolean(\DOMElement $node, $attributeName, $default = null)
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 4 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   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 
278 278
         if ($xml->getAttribute('Version') !== '2.0') {
279 279
             /* Currently a very strict check. */
280
-            throw new \Exception('Unsupported version: ' . $xml->getAttribute('Version'));
280
+            throw new \Exception('Unsupported version: '.$xml->getAttribute('Version'));
281 281
         }
282 282
 
283 283
         $this->issueInstant = Utils::xsDateTimeToTimestamp($xml->getAttribute('IssueInstant'));
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
                 continue;
380 380
             }
381 381
             if ($node->namespaceURI !== Constants::NS_SAML) {
382
-                throw new \Exception('Unknown namespace of condition: ' . var_export($node->namespaceURI, true));
382
+                throw new \Exception('Unknown namespace of condition: '.var_export($node->namespaceURI, true));
383 383
             }
384 384
             switch ($node->localName) {
385 385
                 case 'AudienceRestriction':
@@ -402,7 +402,7 @@  discard block
 block discarded – undo
402 402
                     /* Currently ignored. */
403 403
                     break;
404 404
                 default:
405
-                    throw new \Exception('Unknown condition: ' . var_export($node->localName, true));
405
+                    throw new \Exception('Unknown condition: '.var_export($node->localName, true));
406 406
             }
407 407
         }
408 408
     }
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
             }
590 590
             
591 591
             if ($type === 'xs:integer') {
592
-                $this->attributes[$attributeName][] = (int)$value->textContent;
592
+                $this->attributes[$attributeName][] = (int) $value->textContent;
593 593
             } else {
594 594
                 $this->attributes[$attributeName][] = trim($value->textContent);
595 595
             }
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
             $document = $parentElement->ownerDocument;
1368 1368
         }
1369 1369
 
1370
-        $root = $document->createElementNS(Constants::NS_SAML, 'saml:' . 'Assertion');
1370
+        $root = $document->createElementNS(Constants::NS_SAML, 'saml:'.'Assertion');
1371 1371
         $parentElement->appendChild($root);
1372 1372
 
1373 1373
         /* Ugly hack to add another namespace declaration to the root element. */
@@ -1423,7 +1423,7 @@  discard block
 block discarded – undo
1423 1423
         if ($this->encryptedNameId === null) {
1424 1424
             $this->nameId->toXML($subject);
1425 1425
         } else {
1426
-            $eid = $subject->ownerDocument->createElementNS(Constants::NS_SAML, 'saml:' . 'EncryptedID');
1426
+            $eid = $subject->ownerDocument->createElementNS(Constants::NS_SAML, 'saml:'.'EncryptedID');
1427 1427
             $subject->appendChild($eid);
1428 1428
             $eid->appendChild($subject->ownerDocument->importNode($this->encryptedNameId, true));
1429 1429
         }
@@ -1575,7 +1575,7 @@  discard block
 block discarded – undo
1575 1575
             if (is_array($this->attributesValueTypes) && array_key_exists($name, $this->attributesValueTypes)) {
1576 1576
                 $valueTypes = $this->attributesValueTypes[$name];
1577 1577
                 if (is_array($valueTypes) && count($valueTypes) != count($values)) {
1578
-                    throw new \Exception('Array of value types and array of values have different size for attribute '. var_export($name, true));
1578
+                    throw new \Exception('Array of value types and array of values have different size for attribute '.var_export($name, true));
1579 1579
                 }
1580 1580
             } else {
1581 1581
                 // if no type(s), default behaviour
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 
5 5
 use RobRichards\XMLSecLibs\XMLSecEnc;
6 6
 use RobRichards\XMLSecLibs\XMLSecurityKey;
7
-use SAML2\Exception\RuntimeException;
8 7
 use SAML2\Utilities\Temporal;
9 8
 use SAML2\XML\Chunk;
10 9
 use SAML2\XML\saml\SubjectConfirmation;
Please login to merge, or discard this patch.
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
     /**
729 729
      * Set the issuer of this message.
730 730
      *
731
-     * @param string|\SAML2\XML\saml\Issuer $issuer The new issuer of this assertion.
731
+     * @param string $issuer The new issuer of this assertion.
732 732
      */
733 733
     public function setIssuer($issuer)
734 734
     {
@@ -774,7 +774,7 @@  discard block
 block discarded – undo
774 774
     /**
775 775
      * Check whether the NameId is encrypted.
776 776
      *
777
-     * @return true if the NameId is encrypted, false if not.
777
+     * @return boolean if the NameId is encrypted, false if not.
778 778
      */
779 779
     public function isNameIdEncrypted()
780 780
     {
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
      *
1210 1210
      * The URI reference MAY directly resolve into an XML document containing the referenced declaration.
1211 1211
      *
1212
-     * @return string
1212
+     * @return Chunk
1213 1213
      */
1214 1214
     public function getAuthnContextDeclRef()
1215 1215
     {
@@ -1341,7 +1341,7 @@  discard block
 block discarded – undo
1341 1341
     /**
1342 1342
      * Retrieve the encryptedAttributes elements we have.
1343 1343
      *
1344
-     * @return array Array of \DOMElement elements.
1344
+     * @return \DOMElement[] Array of \DOMElement elements.
1345 1345
      */
1346 1346
     public function getEncryptedAttributes()
1347 1347
     {
@@ -1351,7 +1351,7 @@  discard block
 block discarded – undo
1351 1351
     /**
1352 1352
      * Set the encryptedAttributes elements
1353 1353
      *
1354
-     * @param array $encAttrs Array of \DOMElement elements.
1354
+     * @param \DOMElement[] $encAttrs Array of \DOMElement elements.
1355 1355
      */
1356 1356
     public function setEncryptedAttributes(array $encAttrs)
1357 1357
     {
Please login to merge, or discard this patch.
src/SAML2/Response.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
     /**
46 46
      * Retrieve the assertions in this response.
47 47
      *
48
-     * @return \SAML2\Assertion[]|\SAML2\EncryptedAssertion[]
48
+     * @return Utilities\ArrayCollection
49 49
      */
50 50
     public function getAssertions()
51 51
     {
Please login to merge, or discard this patch.
src/SAML2/Response/Processor.php 1 patch
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
      * @param \SAML2\Configuration\Destination      $currentDestination
65 65
      * @param \SAML2\Response                       $response
66 66
      *
67
-     * @return \SAML2\Assertion[] Collection (\SAML2\Utilities\ArrayCollection) of \SAML2\Assertion objects
67
+     * @return \SAML2\Utilities\ArrayCollection Collection (\SAML2\Utilities\ArrayCollection) of \SAML2\Assertion objects
68 68
      */
69 69
     public function process(
70 70
         ServiceProvider $serviceProviderConfiguration,
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     /**
135 135
      * @param \SAML2\Response $response
136 136
      *
137
-     * @return \SAML2\Assertion[]
137
+     * @return \SAML2\Utilities\ArrayCollection
138 138
      */
139 139
     private function processAssertions(Response $response)
140 140
     {
Please login to merge, or discard this patch.
src/SAML2/SOAPClient.php 1 patch
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -212,6 +212,10 @@
 block discarded – undo
212 212
      * @param $soapmessage Soap response needs to be type DOMDocument
213 213
      * @return $soapfaultstring string|null
214 214
      */
215
+
216
+    /**
217
+     * @param \DOMDocument $soapMessage
218
+     */
215 219
     private function getSOAPFault($soapMessage)
216 220
     {
217 221
         $soapFault = Utils::xpQuery($soapMessage->firstChild, '/soap-env:Envelope/soap-env:Body/soap-env:Fault');
Please login to merge, or discard this patch.
src/SAML2/Configuration/IdentityProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
     public function getPrivateKey($name, $required = false)
49 49
     {
50 50
         $privateKeys = $this->get('privateKeys');
51
-        $key = array_filter($privateKeys, function (PrivateKey $key) use ($name) {
51
+        $key = array_filter($privateKeys, function(PrivateKey $key) use ($name) {
52 52
             return $key->getName() === $name;
53 53
         });
54 54
 
Please login to merge, or discard this patch.
src/SAML2/Configuration/ServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@
 block discarded – undo
50 50
     public function getPrivateKey($name, $required = false)
51 51
     {
52 52
         $privateKeys = $this->get('privateKeys');
53
-        $key         = array_filter($privateKeys, function (PrivateKey $key) use ($name) {
53
+        $key         = array_filter($privateKeys, function(PrivateKey $key) use ($name) {
54 54
             return $key->getName() === $name;
55 55
         });
56 56
 
Please login to merge, or discard this patch.
src/SAML2/Constants.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,8 @@
 block discarded – undo
53 53
     const CM_BEARER = 'urn:oasis:names:tc:SAML:2.0:cm:bearer';
54 54
 
55 55
     /**
56
-    * Holder-of-Key subject confirmation method.
57
-    */
56
+     * Holder-of-Key subject confirmation method.
57
+     */
58 58
     const CM_HOK = 'urn:oasis:names:tc:SAML:2.0:cm:holder-of-key';
59 59
     
60 60
     /**
Please login to merge, or discard this patch.