Passed
Pull Request — develop (#37)
by Pieter van der
03:34
created
library/tiqr/Tiqr/StateStorage/Abstract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
      * a state storage instance of a certain type.
61 61
      * @param array $options An array of options for the state storage
62 62
      */
63
-    public function __construct($options=array(), LoggerInterface $logger)
63
+    public function __construct($options = array(), LoggerInterface $logger)
64 64
     {
65 65
         $this->logger = $logger;
66 66
         $this->_options = $options;
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserSecretStorage/Pdo.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     private function getUserSecret($userId)
83 83
     {
84 84
         $sth = $this->handle->prepare("SELECT secret FROM ".$this->tableName." WHERE userid = ?");
85
-        if($sth->execute(array($userId))) {
85
+        if ($sth->execute(array($userId))) {
86 86
             $secret = $sth->fetchColumn();
87 87
             if ($secret !== false) {
88 88
                 return $secret;
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         } else {
105 105
             $sth = $this->handle->prepare("INSERT INTO ".$this->tableName." (secret,userid) VALUES (?,?)");
106 106
         }
107
-        $result = $sth->execute(array($secret,$userId));
107
+        $result = $sth->execute(array($secret, $userId));
108 108
         if (!$result) {
109 109
             throw new ReadWriteException('Unable to persist user secret in user secret storage (PDO)');
110 110
         }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/UserStorage/Pdo.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
         parent::__construct($config, $logger);
47 47
         $this->tablename = isset($config['table']) ? $config['table'] : 'tiqruser';
48 48
         try {
49
-            $this->handle = new PDO($config['dsn'],$config['username'],$config['password']);
49
+            $this->handle = new PDO($config['dsn'], $config['username'], $config['password']);
50 50
         } catch (PDOException $e) {
51 51
             $this->logger->error(
52 52
                 sprintf('Unable to establish a PDO connection. Error message from PDO: %s', $e->getMessage())
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         } else {
62 62
             $sth = $this->handle->prepare("INSERT INTO ".$this->tablename." (displayname,userid) VALUES (?,?)");
63 63
         }
64
-        if ($sth->execute(array($displayName,$userId))){
64
+        if ($sth->execute(array($displayName, $userId))) {
65 65
             return $this->userExists($userId);
66 66
         }
67 67
         throw new ReadWriteException('The user could not be saved in the user storage (PDO)');
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
     public function setNotificationType($userId, $type)
107 107
     {
108 108
         $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET notificationtype = ? WHERE userid = ?");
109
-        if (!$sth->execute(array($type,$userId))) {
109
+        if (!$sth->execute(array($type, $userId))) {
110 110
             throw new ReadWriteException('Unable to set the notification type in user storage for a given user (PDO)');
111 111
         }
112 112
     }
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
     public function setNotificationAddress($userId, $address)
124 124
     {
125 125
         $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET notificationaddress = ?  WHERE userid = ?");
126
-        if (!$sth->execute(array($address,$userId))) {
126
+        if (!$sth->execute(array($address, $userId))) {
127 127
             throw new ReadWriteException('Unable to set the notification address in user storage for a given user (PDO)');
128 128
 
129 129
         }
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
     public function setLoginAttempts($userId, $amount)
142 142
     {
143 143
         $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET loginattempts = ? WHERE userid = ?");
144
-        if (!$sth->execute(array($amount,$userId))) {
144
+        if (!$sth->execute(array($amount, $userId))) {
145 145
             throw new ReadWriteException('Unable to set login attempts in user storage for a given user (PDO)');
146 146
         }
147 147
     }
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     
175 175
     public function setTemporaryBlockAttempts($userId, $amount) {
176 176
         $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET tmpblockattempts = ? WHERE userid = ?");
177
-        if (!$sth->execute(array($amount,$userId))) {
177
+        if (!$sth->execute(array($amount, $userId))) {
178 178
             throw new ReadWriteException('Unable to set temp login attempts in user storage for a given user (PDO)');
179 179
         }
180 180
     }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
     public function setTemporaryBlockTimestamp($userId, $timestamp)
200 200
     {
201 201
         $sth = $this->handle->prepare("UPDATE ".$this->tablename." SET tmpblocktimestamp = ? WHERE userid = ?");
202
-        if (!$sth->execute(array($timestamp,$userId))) {
202
+        if (!$sth->execute(array($timestamp, $userId))) {
203 203
             throw new ReadWriteException('Unable to update temp lock timestamp in user storage for a given user (PDO)');
204 204
         }
205 205
     }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/StateStorage/StateStorageInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
      * @param int $expire The expiration (in seconds) of the data
25 25
      * @throws ReadWriteException
26 26
      */
27
-    public function setValue($key, $value, $expire=0);
27
+    public function setValue($key, $value, $expire = 0);
28 28
 
29 29
     /**
30 30
      * Remove a value from the state storage
Please login to merge, or discard this patch.
library/tiqr/Tiqr/StateStorage/File.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
         $this->path = $path;
45 45
     }
46 46
 
47
-    public function setValue($key, $value, $expire=0)
47
+    public function setValue($key, $value, $expire = 0)
48 48
     {   
49 49
         $envelope = array("expire"=>$expire,
50 50
                           "createdAt"=>time(),
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 
99 99
     private function getPath(): string
100 100
     {
101
-        if (substr($this->path, -1)!=="/") {
102
-            return $this->path . "/";
101
+        if (substr($this->path, -1) !== "/") {
102
+            return $this->path."/";
103 103
         }
104 104
         return $this->path;
105 105
     }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/StateStorage/Pdo.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     private function cleanExpired() {
75 75
         $sth = $this->handle->prepare("DELETE FROM ".$this->tablename." WHERE `expire` < ? AND NOT `expire` = 0");
76 76
         $result = $sth->execute(array(time()));
77
-        if (!$result || $sth->rowCount() === 0){
77
+        if (!$result || $sth->rowCount() === 0) {
78 78
             // No exception is thrown here. The application can continue with expired state for now.
79 79
             $this->logger->error('Unable to remove expired keys from the pdo state storage');
80 80
         }
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
      * (non-PHPdoc)
85 85
      * @see library/tiqr/Tiqr/StateStorage/Tiqr_StateStorage_Abstract::setValue()
86 86
      */
87
-    public function setValue($key, $value, $expire=0)
87
+    public function setValue($key, $value, $expire = 0)
88 88
     {
89
-        if (((float) rand() /(float) getrandmax()) < $this->cleanupProbability) {
89
+        if (((float) rand() / (float) getrandmax()) < $this->cleanupProbability) {
90 90
             $this->cleanExpired();
91 91
         }
92 92
         if ($this->keyExists($key)) {
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
         }
97 97
         // $expire == 0 means never expire
98 98
         if ($expire != 0) {
99
-            $expire+=time();    // Store unix timestamp after which the expires
99
+            $expire += time(); // Store unix timestamp after which the expires
100 100
         }
101
-        if (!$sth->execute(array(serialize($value),$expire,$key))) {
101
+        if (!$sth->execute(array(serialize($value), $expire, $key))) {
102 102
             throw new ReadWriteException(sprintf('Unable to store "%s" state to the PDO', $key));
103 103
         }
104 104
     }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
     public function unsetValue($key)
111 111
     {
112 112
         if ($this->keyExists($key)) {
113
-            $sth = $this->handle->prepare("DELETE FROM " . $this->tablename . " WHERE `key` = ?");
113
+            $sth = $this->handle->prepare("DELETE FROM ".$this->tablename." WHERE `key` = ?");
114 114
             $result = $sth->execute(array($key));
115 115
             if (!$result || $sth->rowCount() === 0) {
116 116
                 throw new ReadWriteException(
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
                 $this->logger->error('Unable to prepare the get key statement');
138 138
                 return NULL;
139 139
             }
140
-            if (false === $sth->execute(array($key, time())) ) {
140
+            if (false === $sth->execute(array($key, time()))) {
141 141
                 $this->logger->error('Unable to get key from the pdo state storage');
142 142
                 return NULL;
143 143
             }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/AutoLoader.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	}
24 24
 
25 25
 	public static function autoload($className) {
26
-		if($className === NULL) {
26
+		if ($className === NULL) {
27 27
 			return;
28 28
 		}
29 29
 
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 		$substr5 = substr($className, 0, 5);
33 33
 
34 34
 		if ($substr5 === 'Tiqr_' || $substr5 === 'OATH_') {
35
-			$file = $self->tiqrPath . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
35
+			$file = $self->tiqrPath.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $className).'.php';
36 36
 		} elseif ($className === 'QRcode') {
37
-			$file = $self->qrcodePath . DIRECTORY_SEPARATOR . 'qrlib.php';
37
+			$file = $self->qrcodePath.DIRECTORY_SEPARATOR.'qrlib.php';
38 38
 		} elseif ($substr5 === 'Zend_') {
39
-			$file = $self->zendPath . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
39
+			$file = $self->zendPath.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $className).'.php';
40 40
         } elseif ($className === 'ReadWriteException') {
41
-            $file = $self->tiqrPath . DIRECTORY_SEPARATOR . 'Tiqr/Exception/ReadWriteException.php';
41
+            $file = $self->tiqrPath.DIRECTORY_SEPARATOR.'Tiqr/Exception/ReadWriteException.php';
42 42
 		} else {
43 43
 			return;
44 44
 		}
@@ -59,34 +59,34 @@  discard block
 block discarded – undo
59 59
 		if (is_dir($tiqr_path)) {
60 60
 			$this->tiqrPath = $tiqr_path;
61 61
 		} else {
62
-			throw new Exception('Directory not found: ' . var_export($tiqr_dir, TRUE));
62
+			throw new Exception('Directory not found: '.var_export($tiqr_dir, TRUE));
63 63
 		}
64 64
 
65 65
 		if (isset($options["phpqrcode.path"])) {
66 66
 			$qrcode_dir = $options["phpqrcode.path"];
67 67
 			$qrcode_path = realpath($qrcode_dir);
68 68
 		} else {
69
-			$qrcode_dir = dirname(dirname(dirname(__FILE__))) . '/phpqrcode';
69
+			$qrcode_dir = dirname(dirname(dirname(__FILE__))).'/phpqrcode';
70 70
 			$qrcode_path = $qrcode_dir;
71 71
 		}
72 72
 
73 73
 		if (is_dir($qrcode_path)) {
74 74
 			$this->qrcodePath = $qrcode_path;
75 75
 		} else {
76
-			throw new Exception('Directory not found: ' . var_export($qrcode_dir, TRUE));
76
+			throw new Exception('Directory not found: '.var_export($qrcode_dir, TRUE));
77 77
 		}
78 78
 
79 79
 		if (isset($options["zend.path"])) {
80 80
 			$zend_dir = $options["zend.path"];
81 81
 			$zend_path = realpath($zend_dir);
82 82
 		} else {
83
-			$zend_dir = dirname(dirname(dirname(__FILE__))) . "/zend";
83
+			$zend_dir = dirname(dirname(dirname(__FILE__)))."/zend";
84 84
 			$zend_path = $zend_dir;
85 85
 		}
86 86
 		if (is_dir($zend_path)) {
87 87
 			$this->zendPath = $zend_path;
88 88
 		} else {
89
-			throw new Exception('Directory not found: ' . var_export($zend_dir, TRUE));
89
+			throw new Exception('Directory not found: '.var_export($zend_dir, TRUE));
90 90
 		}
91 91
 	}
92 92
 
Please login to merge, or discard this patch.
library/tiqr/Tiqr/Service.php 1 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';
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
      * @param array $options
159 159
      * @param int $version The protocol version to use (defaults to the latest)
160 160
      */
161
-    public function __construct(LoggerInterface $logger, $options=array(), $version = 2)
161
+    public function __construct(LoggerInterface $logger, $options = array(), $version = 2)
162 162
     {
163 163
         $this->_options = $options;
164 164
         $this->logger = $logger;
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 
312 312
             $this->logger->info(sprintf('Creating and sending a %s push notification', $notificationType));
313 313
             $message->setId(time());
314
-            $message->setText("Please authenticate for " . $this->_name);
314
+            $message->setText("Please authenticate for ".$this->_name);
315 315
             $message->setAddress($notificationAddress);
316 316
             $message->setCustomProperty('challenge', $this->_getChallengeUrl($sessionKey));
317 317
             $message->send();
@@ -380,13 +380,13 @@  discard block
 block discarded – undo
380 380
      * @param String $spIdentifier If SP and IDP are 2 different things, pass the url/identifier of the SP the user is logging into.
381 381
      *                             For setups where IDP==SP, just leave this blank.
382 382
      */
383
-    public function startAuthenticationSession($userId="", $sessionId="", $spIdentifier="")
383
+    public function startAuthenticationSession($userId = "", $sessionId = "", $spIdentifier = "")
384 384
     {
385
-        if ($sessionId=="") {
385
+        if ($sessionId == "") {
386 386
             $sessionId = session_id();
387 387
         }
388 388
 
389
-        if ($spIdentifier=="") {
389
+        if ($spIdentifier == "") {
390 390
             $spIdentifier = $this->_identifier;
391 391
         }
392 392
 
@@ -396,11 +396,11 @@  discard block
 block discarded – undo
396 396
         
397 397
         $data = array("sessionId"=>$sessionId, "challenge"=>$challenge, "spIdentifier" => $spIdentifier);
398 398
         
399
-        if ($userId!="") {
399
+        if ($userId != "") {
400 400
             $data["userId"] = $userId;
401 401
         }
402 402
         
403
-        $this->_stateStorage->setValue(self::PREFIX_CHALLENGE . $sessionKey, $data, self::CHALLENGE_EXPIRE);
403
+        $this->_stateStorage->setValue(self::PREFIX_CHALLENGE.$sessionKey, $data, self::CHALLENGE_EXPIRE);
404 404
        
405 405
         return $sessionKey;
406 406
     }
@@ -420,9 +420,9 @@  discard block
 block discarded – undo
420 420
      *                           to php session)
421 421
      * @return String The enrollment key
422 422
      */
423
-    public function startEnrollmentSession($userId, $displayName, $sessionId="")
423
+    public function startEnrollmentSession($userId, $displayName, $sessionId = "")
424 424
     {
425
-        if ($sessionId=="") {
425
+        if ($sessionId == "") {
426 426
             $sessionId = session_id();
427 427
         }
428 428
         $enrollmentKey = $this->_uniqueSessionKey(self::PREFIX_ENROLLMENT);
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
             "displayName" => $displayName,
432 432
             "sessionId" => $sessionId
433 433
         ];
434
-        $this->_stateStorage->setValue(self::PREFIX_ENROLLMENT . $enrollmentKey, $data, self::ENROLLMENT_EXPIRE);
434
+        $this->_stateStorage->setValue(self::PREFIX_ENROLLMENT.$enrollmentKey, $data, self::ENROLLMENT_EXPIRE);
435 435
         $this->_setEnrollmentStatus($sessionId, self::ENROLLMENT_STATUS_INITIALIZED);
436 436
 
437 437
         return $enrollmentKey;
@@ -442,9 +442,9 @@  discard block
 block discarded – undo
442 442
      * @param $sessionId The application's session identifier (defaults
443 443
      *                   to php session)
444 444
      */
445
-    public function resetEnrollmentSession($sessionId="")
445
+    public function resetEnrollmentSession($sessionId = "")
446 446
     {
447
-        if ($sessionId=="") {
447
+        if ($sessionId == "") {
448 448
             $sessionId = session_id();
449 449
         }
450 450
 
@@ -489,9 +489,9 @@  discard block
 block discarded – undo
489 489
      *               A first successful authentication was performed 
490 490
      *               (todo: currently not used)
491 491
      */
492
-    public function getEnrollmentStatus($sessionId="")
492
+    public function getEnrollmentStatus($sessionId = "")
493 493
     { 
494
-        if ($sessionId=="") {
494
+        if ($sessionId == "") {
495 495
             $sessionId = session_id(); 
496 496
         }
497 497
         $status = $this->_stateStorage->getValue("enrollstatus".$sessionId);
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
      */
551 551
     public function getEnrollmentMetadata($enrollmentKey, $authenticationUrl, $enrollmentUrl)
552 552
     {
553
-        $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
553
+        $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT.$enrollmentKey);
554 554
         if (!is_array($data)) {
555 555
             $this->logger->error('Unable to find enrollment metadata in state storage');
556 556
             return false;
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
                                array("identifier" =>$data["userId"],
570 570
                                      "displayName"=>$data["displayName"]));
571 571
 
572
-        $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
572
+        $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT.$enrollmentKey);
573 573
 
574 574
         $this->_setEnrollmentStatus($data["sessionId"], self::ENROLLMENT_STATUS_RETRIEVED);
575 575
         return $metadata;
@@ -590,14 +590,14 @@  discard block
 block discarded – undo
590 590
      */
591 591
     public function getEnrollmentSecret($enrollmentKey)
592 592
     {
593
-         $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
593
+         $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT.$enrollmentKey);
594 594
          $secret = $this->_uniqueSessionKey(self::PREFIX_ENROLLMENT_SECRET);
595 595
          $enrollmentData = [
596 596
              "userId" => $data["userId"],
597 597
              "sessionId" => $data["sessionId"]
598 598
          ];
599 599
          $this->_stateStorage->setValue(
600
-             self::PREFIX_ENROLLMENT_SECRET . $secret,
600
+             self::PREFIX_ENROLLMENT_SECRET.$secret,
601 601
              $enrollmentData,
602 602
              self::ENROLLMENT_EXPIRE
603 603
          );
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
              $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT_SECRET.$enrollmentSecret);
648 648
          } else {
649 649
              $this->logger->error(
650
-                 'Enrollment status is not finalized, enrollmentsecret was not found in state storage. ' .
650
+                 'Enrollment status is not finalized, enrollmentsecret was not found in state storage. '.
651 651
                  'Warning! the method will still return "true" as a result.'
652 652
              );
653 653
          }
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
      */
678 678
     public function authenticate($userId, $userSecret, $sessionKey, $response)
679 679
     {
680
-        $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE . $sessionKey);
680
+        $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE.$sessionKey);
681 681
         if (is_null($state)) {
682 682
             $this->logger->info('The auth challenge could not be found in the state storage');
683 683
             return self::AUTH_RESULT_INVALID_CHALLENGE;
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
           $challengeUserId = $state["userId"];
692 692
         }
693 693
         // Check if we're dealing with a second factor
694
-        if ($challengeUserId!=NULL && ($userId != $challengeUserId)) {
694
+        if ($challengeUserId != NULL && ($userId != $challengeUserId)) {
695 695
             $this->logger->error(
696 696
                 'Authentication failed: the first factor user id does not match with that of the second factor'
697 697
             );
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
             $this->_stateStorage->setValue("authenticated_".$sessionId, $userId, self::LOGIN_EXPIRE);
710 710
             
711 711
             // Clean up the challenge.
712
-            $this->_stateStorage->unsetValue(self::PREFIX_CHALLENGE . $sessionKey);
712
+            $this->_stateStorage->unsetValue(self::PREFIX_CHALLENGE.$sessionKey);
713 713
             $this->logger->info('Authentication succeeded');
714 714
             return self::AUTH_RESULT_AUTHENTICATED;
715 715
         }
@@ -722,9 +722,9 @@  discard block
 block discarded – undo
722 722
      * @param String $sessionId The application's session identifier (defaults
723 723
      *                          to the php session).
724 724
      */
725
-    public function logout($sessionId="")
725
+    public function logout($sessionId = "")
726 726
     {
727
-        if ($sessionId=="") {
727
+        if ($sessionId == "") {
728 728
             $sessionId = session_id(); 
729 729
         }
730 730
         
@@ -759,9 +759,9 @@  discard block
 block discarded – undo
759 759
      * @return mixed An array with user data if a user was logged in or NULL if
760 760
      *               no user is logged in.
761 761
      */
762
-    public function getAuthenticatedUser($sessionId="")
762
+    public function getAuthenticatedUser($sessionId = "")
763 763
     {
764
-        if ($sessionId=="") {
764
+        if ($sessionId == "") {
765 765
             $this->logger->debug('Using the PHP session id, as no session id was provided');
766 766
             $sessionId = session_id(); 
767 767
         }
@@ -780,7 +780,7 @@  discard block
 block discarded – undo
780 780
      */
781 781
     protected function _getChallengeUrl($sessionKey)
782 782
     {                
783
-        $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE . $sessionKey);
783
+        $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE.$sessionKey);
784 784
         if (is_null($state)) {
785 785
             $this->logger->error(
786 786
                 'Unable find an existing challenge url in the state storage based on the existing session key'
@@ -788,7 +788,7 @@  discard block
 block discarded – undo
788 788
             return false;
789 789
         }
790 790
         
791
-        $userId   = NULL;
791
+        $userId = NULL;
792 792
         $challenge = $state["challenge"];
793 793
         if (isset($state["userId"])) {
794 794
             $userId = $state["userId"];
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
         $spIdentifier = $state["spIdentifier"];
797 797
         
798 798
         // Last bit is the spIdentifier
799
-        return $this->_protocolAuth."://".(!is_null($userId)?urlencode($userId).'@':'').$this->getIdentifier()."/".$sessionKey."/".$challenge."/".urlencode($spIdentifier)."/".$this->_protocolVersion;
799
+        return $this->_protocolAuth."://".(!is_null($userId) ?urlencode($userId).'@' : '').$this->getIdentifier()."/".$sessionKey."/".$challenge."/".urlencode($spIdentifier)."/".$this->_protocolVersion;
800 800
     }
801 801
 
802 802
     /**
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
     protected function _uniqueSessionKey($prefix)
821 821
     {      
822 822
         $value = 1;
823
-        while ($value!=NULL) {
823
+        while ($value != NULL) {
824 824
             $sessionKey = $this->_ocraWrapper->generateSessionKey();
825 825
             $value = $this->_stateStorage->getValue($prefix.$sessionKey);
826 826
         }
Please login to merge, or discard this patch.