Test Failed
Pull Request — develop (#27)
by Michiel
06:05
created
library/tiqr/Tiqr/DeviceStorage/TokenExchange.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,15 +41,15 @@
 block discarded – undo
41 41
     {
42 42
         $url = $this->_options["url"]."?appId=".$this->_options["appid"];
43 43
         
44
-        $url.= "&notificationToken=".$notificationToken;
44
+        $url .= "&notificationToken=".$notificationToken;
45 45
         
46 46
         $output = file_get_contents($url);
47
-        if (stripos($output, "not found")!==false) {
47
+        if (stripos($output, "not found") !== false) {
48 48
             $this->logger->error('Token Exchange failed and responded with: not found', ['full output' => $output]);
49 49
             return false;
50 50
         }
51 51
 
52
-        if (stripos($output, "error")!==false) {
52
+        if (stripos($output, "error") !== false) {
53 53
             $this->logger->error('Token Exchange failed and responded with: error', ['full output' => $output]);
54 54
             return false;
55 55
         }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/DeviceStorage/Abstract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
58 58
      * the Tiqr_DeviceStorage factory will call this for you.
59 59
      * @param array $options The options for the s
60 60
      */
61
-    public function __construct($options=array(), LoggerInterface $logger)
61
+    public function __construct($options = array(), LoggerInterface $logger)
62 62
     {
63 63
         $this->_options = $options;
64 64
         $this->logger = $logger;
Please login to merge, or discard this patch.
library/tiqr/Tiqr/StateStorage/Memcache.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
      * The default configuration
52 52
      */
53 53
     const DEFAULT_HOST = '127.0.0.1';
54
-    const DEFAULT_PORT =  11211;
54
+    const DEFAULT_PORT = 11211;
55 55
     
56 56
     /**
57 57
      * Get the prefix to use for all keys in memcache.
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      * (non-PHPdoc)
103 103
      * @see library/tiqr/Tiqr/StateStorage/Tiqr_StateStorage_Abstract::setValue()
104 104
      */
105
-    public function setValue($key, $value, $expire=0)
105
+    public function setValue($key, $value, $expire = 0)
106 106
     {  
107 107
         $key = $this->_getKeyPrefix().$key;
108 108
 
Please login to merge, or discard this patch.
library/tiqr/Tiqr/StateStorage/File.php 2 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
     public function setValue($key, $value, $expire=0)
40 40
     {   
41 41
         $envelope = array("expire"=>$expire,
42
-                          "createdAt"=>time(),
43
-                          "value"=>$value);
42
+                            "createdAt"=>time(),
43
+                            "value"=>$value);
44 44
         $filename = $this->_stateFilename($key);
45 45
         
46 46
         file_put_contents($filename, serialize($envelope));
@@ -72,12 +72,12 @@  discard block
 block discarded – undo
72 72
         if (file_exists($filename)) {
73 73
             $envelope = unserialize(file_get_contents($filename));
74 74
             if ($envelope["expire"]!=0) {
75
-                 // This data is time-limited. If it's too old we discard it.
76
-                 if (time()-$envelope["createdAt"] > $envelope["expire"]) {
77
-                     $this->unsetValue($key);
78
-                     $this->logger->error('Unable to retrieve the state storage value, it is expired');
79
-                     return NULL;
80
-                 }
75
+                    // This data is time-limited. If it's too old we discard it.
76
+                    if (time()-$envelope["createdAt"] > $envelope["expire"]) {
77
+                        $this->unsetValue($key);
78
+                        $this->logger->error('Unable to retrieve the state storage value, it is expired');
79
+                        return NULL;
80
+                    }
81 81
             }
82 82
             return $envelope["value"];
83 83
         }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      * (non-PHPdoc)
37 37
      * @see library/tiqr/Tiqr/StateStorage/Tiqr_StateStorage_Abstract::setValue()
38 38
      */
39
-    public function setValue($key, $value, $expire=0)
39
+    public function setValue($key, $value, $expire = 0)
40 40
     {   
41 41
         $envelope = array("expire"=>$expire,
42 42
                           "createdAt"=>time(),
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
         $filename = $this->_stateFilename($key);
72 72
         if (file_exists($filename)) {
73 73
             $envelope = unserialize(file_get_contents($filename));
74
-            if ($envelope["expire"]!=0) {
74
+            if ($envelope["expire"] != 0) {
75 75
                  // This data is time-limited. If it's too old we discard it.
76
-                 if (time()-$envelope["createdAt"] > $envelope["expire"]) {
76
+                 if (time() - $envelope["createdAt"] > $envelope["expire"]) {
77 77
                      $this->unsetValue($key);
78 78
                      $this->logger->error('Unable to retrieve the state storage value, it is expired');
79 79
                      return NULL;
Please login to merge, or discard this patch.
library/tiqr/Tiqr/StateStorage/Pdo.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 
72 72
     private function cleanExpired() {
73 73
         $sth = $this->handle->prepare("DELETE FROM ".$this->tablename." WHERE `expire` < ? AND NOT `expire` = 0");
74
-        if (!$sth->execute(array(time()))){
74
+        if (!$sth->execute(array(time()))) {
75 75
             $this->logger->error('Unable to remove expired keys from the pdo state storage');
76 76
         }
77 77
     }
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
      * (non-PHPdoc)
81 81
      * @see library/tiqr/Tiqr/StateStorage/Tiqr_StateStorage_Abstract::setValue()
82 82
      */
83
-    public function setValue($key, $value, $expire=0)
83
+    public function setValue($key, $value, $expire = 0)
84 84
     {
85
-        if (((float) rand() /(float) getrandmax()) < $this->cleanupProbability) {
85
+        if (((float) rand() / (float) getrandmax()) < $this->cleanupProbability) {
86 86
             $this->cleanExpired();
87 87
         }
88 88
         if ($this->keyExists($key)) {
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
         }
93 93
         // $expire == 0 means never expire
94 94
         if ($expire != 0) {
95
-            $expire+=time();    // Store unix timestamp after which the expires
95
+            $expire += time(); // Store unix timestamp after which the expires
96 96
         }
97
-        $sth->execute(array(serialize($value),$expire,$key));
97
+        $sth->execute(array(serialize($value), $expire, $key));
98 98
     }
99 99
         
100 100
     /**
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
                 $this->logger->error('Unable to prepare the get key statement');
122 122
                 return NULL;
123 123
             }
124
-            if (false === $sth->execute(array($key, time())) ) {
124
+            if (false === $sth->execute(array($key, time()))) {
125 125
                 $this->logger->error('Unable to get key from the pdo state storage');
126 126
                 return NULL;
127 127
             }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/StateStorage/Abstract.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
      * @param mixed $value The data to store in state storage
48 48
      * @param int $expire The expiration (in seconds) of the data
49 49
      */
50
-    public abstract function setValue($key, $value, $expire=0);
50
+    public abstract function setValue($key, $value, $expire = 0);
51 51
     
52 52
     /**
53 53
      * Remove a value from the state storage
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      * a state storage instance of a certain type.
82 82
      * @param array $options An array of options for the state storage
83 83
      */
84
-    public function __construct($options=array(), LoggerInterface $logger)
84
+    public function __construct($options = array(), LoggerInterface $logger)
85 85
     {
86 86
         $this->logger = $logger;
87 87
         $this->_options = $options;        
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserStorage/GenericStore.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     public function createUser($userId, $displayName) 
44 44
     {
45 45
         $user = array("userId"=>$userId,
46
-                      "displayName"=>$displayName);
46
+                        "displayName"=>$displayName);
47 47
         return $this->_saveUser($userId, $user);
48 48
     }
49 49
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     {
78 78
         if ($data = $this->_loadUser($userId)) {
79 79
             if (isset($data["notificationType"])) {
80
-               return $data["notificationType"];
80
+                return $data["notificationType"];
81 81
             }
82 82
         }
83 83
         return NULL;
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     {
103 103
         if ($data = $this->_loadUser($userId)) {
104 104
             if (isset($data["notificationAddress"])) {
105
-               return $data["notificationAddress"];
105
+                return $data["notificationAddress"];
106 106
             }
107 107
         }
108 108
         $this->logger->info('Unable to find notification address for user');
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserStorage/Encryption.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@
 block discarded – undo
40 40
      *
41 41
      * @return Tiqr_UserStorage_Encryption_Interface
42 42
      */
43
-    public static function getEncryption(LoggerInterface $logger, $type="dummy", $options=array())
43
+    public static function getEncryption(LoggerInterface $logger, $type = "dummy", $options = array())
44 44
     {
45 45
         $logger->info(sprintf('Using %s as UserStorage encryption type', $type));
46 46
         switch ($type) {
Please login to merge, or discard this patch.
library/tiqr/Tiqr/Service.php 2 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -552,17 +552,17 @@  discard block
 block discarded – undo
552 552
         }
553 553
 
554 554
         $metadata = array("service"=>
555
-                               array("displayName"       => $this->_name,
556
-                                     "identifier"        => $this->_identifier,
557
-                                     "logoUrl"           => $this->_logoUrl,
558
-                                     "infoUrl"           => $this->_infoUrl,
559
-                                     "authenticationUrl" => $authenticationUrl,
560
-                                     "ocraSuite"         => $this->_ocraSuite,
561
-                                     "enrollmentUrl"     => $enrollmentUrl
562
-                               ),
563
-                          "identity"=>
564
-                               array("identifier" =>$data["userId"],
565
-                                     "displayName"=>$data["displayName"]));
555
+                                array("displayName"       => $this->_name,
556
+                                        "identifier"        => $this->_identifier,
557
+                                        "logoUrl"           => $this->_logoUrl,
558
+                                        "infoUrl"           => $this->_infoUrl,
559
+                                        "authenticationUrl" => $authenticationUrl,
560
+                                        "ocraSuite"         => $this->_ocraSuite,
561
+                                        "enrollmentUrl"     => $enrollmentUrl
562
+                                ),
563
+                            "identity"=>
564
+                                array("identifier" =>$data["userId"],
565
+                                        "displayName"=>$data["displayName"]));
566 566
 
567 567
         $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
568 568
 
@@ -585,18 +585,18 @@  discard block
 block discarded – undo
585 585
      */
586 586
     public function getEnrollmentSecret($enrollmentKey)
587 587
     {
588
-         $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
589
-         $secret = $this->_uniqueSessionKey(self::PREFIX_ENROLLMENT_SECRET);
590
-         $enrollmentData = [
591
-             "userId" => $data["userId"],
592
-             "sessionId" => $data["sessionId"]
593
-         ];
594
-         $this->_stateStorage->setValue(
595
-             self::PREFIX_ENROLLMENT_SECRET . $secret,
596
-             $enrollmentData,
597
-             self::ENROLLMENT_EXPIRE
598
-         );
599
-         return $secret;
588
+            $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
589
+            $secret = $this->_uniqueSessionKey(self::PREFIX_ENROLLMENT_SECRET);
590
+            $enrollmentData = [
591
+                "userId" => $data["userId"],
592
+                "sessionId" => $data["sessionId"]
593
+            ];
594
+            $this->_stateStorage->setValue(
595
+                self::PREFIX_ENROLLMENT_SECRET . $secret,
596
+                $enrollmentData,
597
+                self::ENROLLMENT_EXPIRE
598
+            );
599
+            return $secret;
600 600
     } 
601 601
 
602 602
     /**
@@ -635,18 +635,18 @@  discard block
 block discarded – undo
635 635
      */
636 636
     public function finalizeEnrollment($enrollmentSecret) 
637 637
     {
638
-         $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret);
639
-         if (is_array($data)) {
640
-             // Enrollment is finalized, destroy our session data.
641
-             $this->_setEnrollmentStatus($data["sessionId"], self::ENROLLMENT_STATUS_FINALIZED);
642
-             $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret);
643
-         } else {
644
-             $this->logger->error(
645
-                 'Enrollment status is not finalized, enrollmentsecret was not found in state storage. ' .
646
-                 'Warning! the method will still return "true" as a result.'
647
-             );
648
-         }
649
-         return true;
638
+            $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret);
639
+            if (is_array($data)) {
640
+                // Enrollment is finalized, destroy our session data.
641
+                $this->_setEnrollmentStatus($data["sessionId"], self::ENROLLMENT_STATUS_FINALIZED);
642
+                $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret);
643
+            } else {
644
+                $this->logger->error(
645
+                    'Enrollment status is not finalized, enrollmentsecret was not found in state storage. ' .
646
+                    'Warning! the method will still return "true" as a result.'
647
+                );
648
+            }
649
+            return true;
650 650
     }
651 651
 
652 652
     /**
@@ -683,7 +683,7 @@  discard block
 block discarded – undo
683 683
 
684 684
         $challengeUserId = NULL;
685 685
         if (isset($state["userId"])) {
686
-          $challengeUserId = $state["userId"];
686
+            $challengeUserId = $state["userId"];
687 687
         }
688 688
         // Check if we're dealing with a second factor
689 689
         if ($challengeUserId!=NULL && ($userId != $challengeUserId)) {
@@ -830,6 +830,6 @@  discard block
 block discarded – undo
830 830
      */
831 831
     protected function _setEnrollmentStatus($sessionId, $status)
832 832
     {
833
-       $this->_stateStorage->setValue("enrollstatus".$sessionId, $status, self::ENROLLMENT_EXPIRE);
833
+        $this->_stateStorage->setValue("enrollstatus".$sessionId, $status, self::ENROLLMENT_EXPIRE);
834 834
     }
835 835
 }
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
     /**
75 75
      * Enrollment status codes
76 76
      */
77
-    const ENROLLMENT_STATUS_IDLE = 1;        // Nothing happens
77
+    const ENROLLMENT_STATUS_IDLE = 1; // Nothing happens
78 78
     const ENROLLMENT_STATUS_INITIALIZED = 2; // An enrollment session has begun
79
-    const ENROLLMENT_STATUS_RETRIEVED = 3;   // The device has retrieved the metadata
80
-    const ENROLLMENT_STATUS_PROCESSED = 4;   // The device has snet back a secret
81
-    const ENROLLMENT_STATUS_FINALIZED = 5;   // The application has stored the secret
82
-    const ENROLLMENT_STATUS_VALIDATED = 6;   // A first succesful authentication was performed
79
+    const ENROLLMENT_STATUS_RETRIEVED = 3; // The device has retrieved the metadata
80
+    const ENROLLMENT_STATUS_PROCESSED = 4; // The device has snet back a secret
81
+    const ENROLLMENT_STATUS_FINALIZED = 5; // The application has stored the secret
82
+    const ENROLLMENT_STATUS_VALIDATED = 6; // A first succesful authentication was performed
83 83
 
84 84
     const PREFIX_ENROLLMENT_SECRET = 'enrollsecret';
85 85
     const PREFIX_ENROLLMENT = 'enroll';
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      * @param array $options
163 163
      * @param int $version The protocol version to use (defaults to the latest)
164 164
      */
165
-    public function __construct(LoggerInterface $logger, $options=array(), $version = 2)
165
+    public function __construct(LoggerInterface $logger, $options = array(), $version = 2)
166 166
     {
167 167
         $this->_options = $options;
168 168
         $this->logger = $logger;
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
             $this->logger->info(sprintf('Creating and sending a %s push notification', $notificationType));
307 307
             $message = new $class($this->_options);
308 308
             $message->setId(time());
309
-            $message->setText("Please authenticate for " . $this->_name);
309
+            $message->setText("Please authenticate for ".$this->_name);
310 310
             $message->setAddress($notificationAddress);
311 311
             $message->setCustomProperty('challenge', $this->_getChallengeUrl($sessionKey));
312 312
             $message->send();
@@ -375,13 +375,13 @@  discard block
 block discarded – undo
375 375
      * @param String $spIdentifier If SP and IDP are 2 different things, pass the url/identifier of the SP the user is logging into.
376 376
      *                             For setups where IDP==SP, just leave this blank.
377 377
      */
378
-    public function startAuthenticationSession($userId="", $sessionId="", $spIdentifier="")
378
+    public function startAuthenticationSession($userId = "", $sessionId = "", $spIdentifier = "")
379 379
     {
380
-        if ($sessionId=="") {
380
+        if ($sessionId == "") {
381 381
             $sessionId = session_id();
382 382
         }
383 383
 
384
-        if ($spIdentifier=="") {
384
+        if ($spIdentifier == "") {
385 385
             $spIdentifier = $this->_identifier;
386 386
         }
387 387
 
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
         
392 392
         $data = array("sessionId"=>$sessionId, "challenge"=>$challenge, "spIdentifier" => $spIdentifier);
393 393
         
394
-        if ($userId!="") {
394
+        if ($userId != "") {
395 395
             $data["userId"] = $userId;
396 396
         }
397 397
         
398
-        $this->_stateStorage->setValue(self::PREFIX_CHALLENGE . $sessionKey, $data, self::CHALLENGE_EXPIRE);
398
+        $this->_stateStorage->setValue(self::PREFIX_CHALLENGE.$sessionKey, $data, self::CHALLENGE_EXPIRE);
399 399
        
400 400
         return $sessionKey;
401 401
     }
@@ -415,9 +415,9 @@  discard block
 block discarded – undo
415 415
      *                           to php session)
416 416
      * @return String The enrollment key
417 417
      */
418
-    public function startEnrollmentSession($userId, $displayName, $sessionId="")
418
+    public function startEnrollmentSession($userId, $displayName, $sessionId = "")
419 419
     {
420
-        if ($sessionId=="") {
420
+        if ($sessionId == "") {
421 421
             $sessionId = session_id();
422 422
         }
423 423
         $enrollmentKey = $this->_uniqueSessionKey(self::PREFIX_ENROLLMENT);
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
             "displayName" => $displayName,
427 427
             "sessionId" => $sessionId
428 428
         ];
429
-        $this->_stateStorage->setValue(self::PREFIX_ENROLLMENT . $enrollmentKey, $data, self::ENROLLMENT_EXPIRE);
429
+        $this->_stateStorage->setValue(self::PREFIX_ENROLLMENT.$enrollmentKey, $data, self::ENROLLMENT_EXPIRE);
430 430
         $this->_setEnrollmentStatus($sessionId, self::ENROLLMENT_STATUS_INITIALIZED);
431 431
 
432 432
         return $enrollmentKey;
@@ -437,9 +437,9 @@  discard block
 block discarded – undo
437 437
      * @param $sessionId The application's session identifier (defaults
438 438
      *                   to php session)
439 439
      */
440
-    public function resetEnrollmentSession($sessionId="")
440
+    public function resetEnrollmentSession($sessionId = "")
441 441
     {
442
-        if ($sessionId=="") {
442
+        if ($sessionId == "") {
443 443
             $sessionId = session_id();
444 444
         }
445 445
 
@@ -484,9 +484,9 @@  discard block
 block discarded – undo
484 484
      *               A first successful authentication was performed 
485 485
      *               (todo: currently not used)
486 486
      */
487
-    public function getEnrollmentStatus($sessionId="")
487
+    public function getEnrollmentStatus($sessionId = "")
488 488
     { 
489
-        if ($sessionId=="") {
489
+        if ($sessionId == "") {
490 490
             $sessionId = session_id(); 
491 491
         }
492 492
         $status = $this->_stateStorage->getValue("enrollstatus".$sessionId);
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
      */
546 546
     public function getEnrollmentMetadata($enrollmentKey, $authenticationUrl, $enrollmentUrl)
547 547
     {
548
-        $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
548
+        $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT.$enrollmentKey);
549 549
         if (!is_array($data)) {
550 550
             $this->logger->error('Unable to find enrollment metadata in state storage');
551 551
             return false;
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
                                array("identifier" =>$data["userId"],
565 565
                                      "displayName"=>$data["displayName"]));
566 566
 
567
-        $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
567
+        $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT.$enrollmentKey);
568 568
 
569 569
         $this->_setEnrollmentStatus($data["sessionId"], self::ENROLLMENT_STATUS_RETRIEVED);
570 570
         return $metadata;
@@ -585,14 +585,14 @@  discard block
 block discarded – undo
585 585
      */
586 586
     public function getEnrollmentSecret($enrollmentKey)
587 587
     {
588
-         $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
588
+         $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT.$enrollmentKey);
589 589
          $secret = $this->_uniqueSessionKey(self::PREFIX_ENROLLMENT_SECRET);
590 590
          $enrollmentData = [
591 591
              "userId" => $data["userId"],
592 592
              "sessionId" => $data["sessionId"]
593 593
          ];
594 594
          $this->_stateStorage->setValue(
595
-             self::PREFIX_ENROLLMENT_SECRET . $secret,
595
+             self::PREFIX_ENROLLMENT_SECRET.$secret,
596 596
              $enrollmentData,
597 597
              self::ENROLLMENT_EXPIRE
598 598
          );
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
              $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret);
643 643
          } else {
644 644
              $this->logger->error(
645
-                 'Enrollment status is not finalized, enrollmentsecret was not found in state storage. ' .
645
+                 'Enrollment status is not finalized, enrollmentsecret was not found in state storage. '.
646 646
                  'Warning! the method will still return "true" as a result.'
647 647
              );
648 648
          }
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
      */
673 673
     public function authenticate($userId, $userSecret, $sessionKey, $response)
674 674
     {
675
-        $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE . $sessionKey);
675
+        $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE.$sessionKey);
676 676
         if (is_null($state)) {
677 677
             $this->logger->info('The auth challenge could not be found in the state storage');
678 678
             return self::AUTH_RESULT_INVALID_CHALLENGE;
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
           $challengeUserId = $state["userId"];
687 687
         }
688 688
         // Check if we're dealing with a second factor
689
-        if ($challengeUserId!=NULL && ($userId != $challengeUserId)) {
689
+        if ($challengeUserId != NULL && ($userId != $challengeUserId)) {
690 690
             $this->logger->error(
691 691
                 'Authentication failed: the first factor user id does not match with that of the second factor'
692 692
             );
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
             $this->_stateStorage->setValue("authenticated_".$sessionId, $userId, self::LOGIN_EXPIRE);
705 705
             
706 706
             // Clean up the challenge.
707
-            $this->_stateStorage->unsetValue(self::PREFIX_CHALLENGE . $sessionKey);
707
+            $this->_stateStorage->unsetValue(self::PREFIX_CHALLENGE.$sessionKey);
708 708
             $this->logger->info('Authentication succeeded');
709 709
             return self::AUTH_RESULT_AUTHENTICATED;
710 710
         }
@@ -717,9 +717,9 @@  discard block
 block discarded – undo
717 717
      * @param String $sessionId The application's session identifier (defaults
718 718
      *                          to the php session).
719 719
      */
720
-    public function logout($sessionId="")
720
+    public function logout($sessionId = "")
721 721
     {
722
-        if ($sessionId=="") {
722
+        if ($sessionId == "") {
723 723
             $sessionId = session_id(); 
724 724
         }
725 725
         
@@ -754,9 +754,9 @@  discard block
 block discarded – undo
754 754
      * @return mixed An array with user data if a user was logged in or NULL if
755 755
      *               no user is logged in.
756 756
      */
757
-    public function getAuthenticatedUser($sessionId="")
757
+    public function getAuthenticatedUser($sessionId = "")
758 758
     {
759
-        if ($sessionId=="") {
759
+        if ($sessionId == "") {
760 760
             $this->logger->debug('Using the PHP session id, as no session id was provided');
761 761
             $sessionId = session_id(); 
762 762
         }
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
      */
776 776
     protected function _getChallengeUrl($sessionKey)
777 777
     {                
778
-        $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE . $sessionKey);
778
+        $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE.$sessionKey);
779 779
         if (is_null($state)) {
780 780
             $this->logger->error(
781 781
                 'Unable find an existing challenge url in the state storage based on the existing session key'
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
             return false;
784 784
         }
785 785
         
786
-        $userId   = NULL;
786
+        $userId = NULL;
787 787
         $challenge = $state["challenge"];
788 788
         if (isset($state["userId"])) {
789 789
             $userId = $state["userId"];
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
         $spIdentifier = $state["spIdentifier"];
792 792
         
793 793
         // Last bit is the spIdentifier
794
-        return $this->_protocolAuth."://".(!is_null($userId)?urlencode($userId).'@':'').$this->getIdentifier()."/".$sessionKey."/".$challenge."/".urlencode($spIdentifier)."/".$this->_protocolVersion;
794
+        return $this->_protocolAuth."://".(!is_null($userId) ?urlencode($userId).'@' : '').$this->getIdentifier()."/".$sessionKey."/".$challenge."/".urlencode($spIdentifier)."/".$this->_protocolVersion;
795 795
     }
796 796
 
797 797
     /**
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
     protected function _uniqueSessionKey($prefix)
816 816
     {      
817 817
         $value = 1;
818
-        while ($value!=NULL) {
818
+        while ($value != NULL) {
819 819
             $sessionKey = $this->_ocraWrapper->generateSessionKey();
820 820
             $value = $this->_stateStorage->getValue($prefix.$sessionKey);
821 821
         }
Please login to merge, or discard this patch.