Test Failed
Push — develop ( 5f6d11...6f0171 )
by Pieter van der
04:16 queued 16s
created
library/tiqr/Tiqr/OATH/HOTP.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -46,25 +46,25 @@  discard block
 block discarded – undo
46 46
      * @param String $counter
47 47
      * @return String hash
48 48
      */
49
-    protected function _getHash ($secret, $counter)
49
+    protected function _getHash($secret, $counter)
50 50
     {
51 51
          // Counter
52 52
          //the counter value can be more than one byte long, so we need to go multiple times
53
-         $cur_counter = array(0,0,0,0,0,0,0,0);
54
-         for($i=7;$i>=0;$i--)
53
+         $cur_counter = array(0, 0, 0, 0, 0, 0, 0, 0);
54
+         for ($i = 7; $i >= 0; $i--)
55 55
          {
56
-             $cur_counter[$i] = pack ('C*', $counter);
56
+             $cur_counter[$i] = pack('C*', $counter);
57 57
              $counter = $counter >> 8;
58 58
          }
59 59
          $bin_counter = implode($cur_counter);
60 60
          // Pad to 8 chars
61
-         if (strlen ($bin_counter) < 8)
61
+         if (strlen($bin_counter) < 8)
62 62
          {
63
-             $bin_counter = str_repeat (chr(0), 8 - strlen ($bin_counter)) . $bin_counter;
63
+             $bin_counter = str_repeat(chr(0), 8 - strlen($bin_counter)).$bin_counter;
64 64
          }
65 65
      
66 66
          // HMAC
67
-         $hash = hash_hmac ('sha1', $bin_counter, $secret);
67
+         $hash = hash_hmac('sha1', $bin_counter, $secret);
68 68
          return $hash;
69 69
     }
70 70
  
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
     protected function _truncate($hash, $length = 6)
78 78
     {
79 79
          // Convert to dec
80
-         foreach(str_split($hash,2) as $hex)
80
+         foreach (str_split($hash, 2) as $hex)
81 81
          {
82
-             $hmac_result[]=hexdec($hex);
82
+             $hmac_result[] = hexdec($hex);
83 83
          }
84 84
      
85 85
          // Find offset
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
          // Algorithm from RFC
89 89
          return
90 90
          (
91
-             (($hmac_result[$offset+0] & 0x7f) << 24 ) |
92
-             (($hmac_result[$offset+1] & 0xff) << 16 ) |
93
-             (($hmac_result[$offset+2] & 0xff) << 8 ) |
94
-             ($hmac_result[$offset+3] & 0xff)
95
-         ) % pow(10,$length);
91
+             (($hmac_result[$offset + 0] & 0x7f) << 24) |
92
+             (($hmac_result[$offset + 1] & 0xff) << 16) |
93
+             (($hmac_result[$offset + 2] & 0xff) << 8) |
94
+             ($hmac_result[$offset + 3] & 0xff)
95
+         ) % pow(10, $length);
96 96
     }
97 97
 }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/Message/Exception/MismatchSenderId.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      * @param boolean   $temporary  temporary failure?
36 36
      * @param Exception $parent     parent exception
37 37
      */
38
-    public function __construct($message, $temporary=false, Exception $parent=null)
38
+    public function __construct($message, $temporary = false, Exception $parent = null)
39 39
     {
40 40
         parent::__construct($message, $parent);
41 41
         $this->_temporary = $temporary;
Please login to merge, or discard this patch.
library/tiqr/Tiqr/Message/GCM.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@
 block discarded – undo
102 102
         }
103 103
 
104 104
         if ($error != null) {
105
-            throw new Tiqr_Message_Exception_SendFailure("Error in GCM response: " . $error, true);
105
+            throw new Tiqr_Message_Exception_SendFailure("Error in GCM response: ".$error, true);
106 106
         }
107 107
 
108 108
     }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/Message/Exception.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
      * @param string    $message    exception message
30 30
      * @param Exception $parent     parent exception
31 31
      */
32
-     public function __construct($message, $parent=null)
32
+     public function __construct($message, $parent = null)
33 33
      {
34 34
          parent::__construct($message, 0, $parent);
35 35
      }
Please login to merge, or discard this patch.
library/tiqr/OATH/OCRAParser.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	 */
42 42
 	private function parseOCRASuite($ocraSuite) {
43 43
 		if (!is_string($ocraSuite)) {
44
-			throw new Exception('OCRASuite not in string format: ' . var_export($ocraSuite, TRUE));
44
+			throw new Exception('OCRASuite not in string format: '.var_export($ocraSuite, TRUE));
45 45
 		}
46 46
 
47 47
 		$ocraSuite = strtoupper($ocraSuite);
@@ -49,54 +49,54 @@  discard block
 block discarded – undo
49 49
 
50 50
 		$s = explode(':', $ocraSuite);
51 51
 		if (count($s) != 3) {
52
-			throw new Exception('Invalid OCRASuite format: ' . var_export($ocraSuite, TRUE));
52
+			throw new Exception('Invalid OCRASuite format: '.var_export($ocraSuite, TRUE));
53 53
 		}
54 54
 
55 55
 		$algo = explode('-', $s[0]);
56 56
 		if (count($algo) != 2) {
57
-			throw new Exception('Invalid OCRA version: ' . var_export($s[0], TRUE));
57
+			throw new Exception('Invalid OCRA version: '.var_export($s[0], TRUE));
58 58
 		}
59 59
 
60 60
 		if ($algo[0] !== 'OCRA') {
61
-			throw new Exception('Unsupported OCRA algorithm: ' . var_export($algo[0], TRUE));
61
+			throw new Exception('Unsupported OCRA algorithm: '.var_export($algo[0], TRUE));
62 62
 		}
63 63
 
64 64
 		if ($algo[1] !== '1') {
65
-			throw new Exception('Unsupported OCRA version: ' . var_export($algo[1], TRUE));
65
+			throw new Exception('Unsupported OCRA version: '.var_export($algo[1], TRUE));
66 66
 		}
67 67
 		$this->OCRAVersion = $algo[1];
68 68
 
69 69
 		$cf = explode('-', $s[1]);
70 70
 		if (count($cf) != 3) {
71
-			throw new Exception('Invalid OCRA suite crypto function: ' . var_export($s[1], TRUE));
71
+			throw new Exception('Invalid OCRA suite crypto function: '.var_export($s[1], TRUE));
72 72
 		}
73 73
 
74 74
 		if ($cf[0] !== 'HOTP') {
75
-			throw new Exception('Unsupported OCRA suite crypto function: ' . var_export($cf[0], TRUE));
75
+			throw new Exception('Unsupported OCRA suite crypto function: '.var_export($cf[0], TRUE));
76 76
 		}
77 77
 		$this->CryptoFunctionType = $cf[0];
78 78
 
79 79
 		if (!array_key_exists($cf[1], $this->supportedHashFunctions)) {
80
-			throw new Exception('Unsupported hash function in OCRA suite crypto function: ' . var_export($cf[1], TRUE));
80
+			throw new Exception('Unsupported hash function in OCRA suite crypto function: '.var_export($cf[1], TRUE));
81 81
 		}
82 82
 		$this->CryptoFunctionHash = $cf[1];
83 83
 		$this->CryptoFunctionHashLength = $this->supportedHashFunctions[$cf[1]];
84 84
 
85 85
 		if (!preg_match('/^\d+$/', $cf[2]) || (($cf[2] < 4 || $cf[2] > 10) && $cf[2] != 0)) {
86
-			throw new Exception('Invalid OCRA suite crypto function truncation length: ' . var_export($cf[2], TRUE));
86
+			throw new Exception('Invalid OCRA suite crypto function truncation length: '.var_export($cf[2], TRUE));
87 87
 		}
88 88
 		$this->CryptoFunctionTruncation = intval($cf[2]);
89 89
 
90 90
 		$di = explode('-', $s[2]);
91 91
 		if (count($cf) == 0) {
92
-			throw new Exception('Invalid OCRA suite data input: ' . var_export($s[2], TRUE));
92
+			throw new Exception('Invalid OCRA suite data input: '.var_export($s[2], TRUE));
93 93
 		}
94 94
 
95 95
 		$data_input = array();
96
-		foreach($di as $elem) {
96
+		foreach ($di as $elem) {
97 97
 			$letter = $elem[0];
98 98
 			if (array_key_exists($letter, $data_input)) {
99
-				throw new Exception('Duplicate field in OCRA suite data input: ' . var_export($elem, TRUE));
99
+				throw new Exception('Duplicate field in OCRA suite data input: '.var_export($elem, TRUE));
100 100
 			}
101 101
 			$data_input[$letter] = 1;
102 102
 
@@ -108,13 +108,13 @@  discard block
 block discarded – undo
108 108
 				} elseif (preg_match('/^Q([AHN])(\d+)$/', $elem, $match)) {
109 109
 					$q_len = intval($match[2]);
110 110
 					if ($q_len < 4 || $q_len > 64) {
111
-						throw new Exception('Invalid OCRA suite data input question length: ' . var_export($q_len, TRUE));
111
+						throw new Exception('Invalid OCRA suite data input question length: '.var_export($q_len, TRUE));
112 112
 					}
113 113
 					$this->Q = TRUE;
114 114
 					$this->QType = $match[1];
115 115
 					$this->QLength = $q_len;
116 116
 				} else {
117
-					throw new Exception('Invalid OCRA suite data input question: ' . var_export($elem, TRUE));
117
+					throw new Exception('Invalid OCRA suite data input question: '.var_export($elem, TRUE));
118 118
 				}
119 119
 			} elseif ($letter === 'P') {
120 120
 				if (strlen($elem) == 1) {
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 				} else {
123 123
 					$p_algo = substr($elem, 1);
124 124
 					if (!array_key_exists($p_algo, $this->supportedHashFunctions)) {
125
-						throw new Exception('Unsupported OCRA suite PIN hash function: ' . var_export($elem, TRUE));
125
+						throw new Exception('Unsupported OCRA suite PIN hash function: '.var_export($elem, TRUE));
126 126
 					}
127 127
 					$this->P = TRUE;
128 128
 					$this->PType = $p_algo;
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 				} elseif (preg_match('/^S(\d+)$/', $elem, $match)) {
135 135
 					$s_len = intval($match[1]);
136 136
 					if ($s_len <= 0 || $s_len > 512) {
137
-						throw new Exception('Invalid OCRA suite data input session information length: ' . var_export($s_len, TRUE));
137
+						throw new Exception('Invalid OCRA suite data input session information length: '.var_export($s_len, TRUE));
138 138
 					}
139 139
 
140 140
 					$this->S = TRUE;
141 141
 					$this->SLength = $s_len;
142 142
 				} else {
143
-					throw new Exception('Invalid OCRA suite data input session information length: ' . var_export($elem, TRUE));
143
+					throw new Exception('Invalid OCRA suite data input session information length: '.var_export($elem, TRUE));
144 144
 				}
145 145
 			} elseif ($letter === 'T') {
146 146
 				if (strlen($elem) == 1) {
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 					preg_match_all('/(\d+)([HMS])/', $elem, $match);
150 150
 
151 151
 					if (count($match[1]) !== count(array_unique($match[2]))) {
152
-						throw new Exception('Duplicate definitions in OCRA suite data input timestamp: ' . var_export($elem, TRUE));
152
+						throw new Exception('Duplicate definitions in OCRA suite data input timestamp: '.var_export($elem, TRUE));
153 153
 					}
154 154
 
155 155
 					$length = 0;
@@ -157,21 +157,21 @@  discard block
 block discarded – undo
157 157
 						$length += intval($match[1][$i]) * $this->TPeriods[$match[2][$i]];
158 158
 					}
159 159
 					if ($length <= 0) {
160
-						throw new Exception('Invalid OCRA suite data input timestamp: ' . var_export($elem, TRUE));
160
+						throw new Exception('Invalid OCRA suite data input timestamp: '.var_export($elem, TRUE));
161 161
 					}
162 162
 
163 163
 					$this->T = TRUE;
164 164
 					$this->TLength = $length;
165 165
 				} else {
166
-					throw new Exception('Invalid OCRA suite data input timestamp: ' . var_export($elem, TRUE));
166
+					throw new Exception('Invalid OCRA suite data input timestamp: '.var_export($elem, TRUE));
167 167
 				}
168 168
 			} else {
169
-				throw new Exception('Unsupported OCRA suite data input field: ' . var_export($elem, TRUE));
169
+				throw new Exception('Unsupported OCRA suite data input field: '.var_export($elem, TRUE));
170 170
 			}
171 171
 		}
172 172
 
173 173
 		if (!$this->Q) {
174
-			throw new Exception('OCRA suite data input question not defined: ' . var_export($s[2], TRUE));
174
+			throw new Exception('OCRA suite data input question not defined: '.var_export($s[2], TRUE));
175 175
 		}
176 176
 	}
177 177
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 
182 182
 		$bytes = self::generateRandomBytes($q_length);
183 183
 
184
-		switch($q_type) {
184
+		switch ($q_type) {
185 185
 			case 'A':
186 186
 				$challenge = base64_encode($bytes);
187 187
 				$tr = implode("", unpack('H*', $bytes));
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 				$challenge = implode("", unpack('N*', $bytes));
195 195
 				break;
196 196
 			default:
197
-				throw new Exception('Unsupported OCRASuite challenge type: ' . var_export($q_type, TRUE));
197
+				throw new Exception('Unsupported OCRASuite challenge type: '.var_export($q_type, TRUE));
198 198
 				break;
199 199
 		}
200 200
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 
207 207
 	public function generateSessionInformation() {
208 208
 		if (!$this->S) {
209
-			throw new Exception('Session information not defined in OCRASuite: ' . var_export($this->OCRASuite, TRUE));
209
+			throw new Exception('Session information not defined in OCRASuite: '.var_export($this->OCRASuite, TRUE));
210 210
 		}
211 211
 
212 212
 		$s_length = $this->SLength;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 
229 229
 		/* Use mt_rand to generate $length random bytes. */
230 230
 		$data = '';
231
-		for($i = 0; $i < $length; $i++) {
231
+		for ($i = 0; $i < $length; $i++) {
232 232
 			$data .= chr(mt_rand(0, 255));
233 233
 		}
234 234
 
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
 			return openssl_random_pseudo_bytes($length);
247 247
 		}
248 248
 
249
-		if($fp === NULL) {
249
+		if ($fp === NULL) {
250 250
 			if (@file_exists('/dev/urandom')) {
251 251
 				$fp = @fopen('/dev/urandom', 'rb');
252 252
 			} else {
@@ -254,17 +254,17 @@  discard block
 block discarded – undo
254 254
 			}
255 255
 		}
256 256
 
257
-		if($fp !== FALSE) {
257
+		if ($fp !== FALSE) {
258 258
 			/* Read random bytes from /dev/urandom. */
259 259
 			$data = fread($fp, $length);
260
-			if($data === FALSE) {
260
+			if ($data === FALSE) {
261 261
 				throw new Exception('Error reading random data.');
262 262
 			}
263
-			if(strlen($data) != $length) {
263
+			if (strlen($data) != $length) {
264 264
 				if ($fallback) {
265 265
 					$data = self::generateRandomBytesMTrand($length);
266 266
 				} else {
267
-					throw new Exception('Did not get requested number of bytes from random source. Requested (' . $length . ') got (' . strlen($data) . ')');
267
+					throw new Exception('Did not get requested number of bytes from random source. Requested ('.$length.') got ('.strlen($data).')');
268 268
 				}
269 269
 			}
270 270
 		} else {
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			$result &= ($s1[$i] == $s2[$i]);
291 291
 		}
292 292
 
293
-		return (boolean)$result;
293
+		return (boolean) $result;
294 294
 	}
295 295
 
296 296
 }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/Message/Exception/SendFailure.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
      * @param boolean   $temporary  temporary failure?
36 36
      * @param Exception $parent     parent exception
37 37
      */
38
-    public function __construct($message, $temporary=false, Exception $parent=null)
38
+    public function __construct($message, $temporary = false, Exception $parent = null)
39 39
     {
40 40
         parent::__construct($message, $parent);
41 41
         $this->_temporary = $temporary;
Please login to merge, or discard this patch.
library/tiqr/Tiqr/Message/FCM.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @throws Tiqr_Message_Exception_SendFailure
59 59
      */
60
-    private function _sendFirebase($deviceToken, $alert, $challenge, $apiKey, $retry=false)
60
+    private function _sendFirebase($deviceToken, $alert, $challenge, $apiKey, $retry = false)
61 61
     {
62 62
         $msg = array(
63 63
             'challenge' => $challenge,
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
         );
72 72
 
73 73
         $headers = array(
74
-            'Authorization: key=' . $apiKey,
74
+            'Authorization: key='.$apiKey,
75 75
             'Content-Type: application/json',
76 76
         );
77 77
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
         $result = curl_exec($ch);
85 85
         $errors = curl_error($ch);
86 86
         $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
87
-        $remoteip = curl_getinfo($ch,CURLINFO_PRIMARY_IP);
87
+        $remoteip = curl_getinfo($ch, CURLINFO_PRIMARY_IP);
88 88
         curl_close($ch);
89 89
 
90 90
         if ($result === false) {
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         }
93 93
 
94 94
         if (!empty($errors)) {
95
-            throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ". $errors, true);
95
+            throw new Tiqr_Message_Exception_SendFailure("Http error occurred: ".$errors, true);
96 96
         }
97 97
 
98 98
         // Wait and retry once in case of a 502 Bad Gateway error
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         $response = json_decode($result, true);
111 111
         foreach ($response['results'] as $k => $v) {
112 112
             if (isset($v['error'])) {
113
-                throw new Tiqr_Message_Exception_SendFailure("Error in GCM response: " . $v['error'], true);
113
+                throw new Tiqr_Message_Exception_SendFailure("Error in GCM response: ".$v['error'], true);
114 114
             }
115 115
         }
116 116
     }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/Service.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -68,12 +68,12 @@  discard block
 block discarded – undo
68 68
     /**
69 69
      * Enrollment status codes
70 70
      */
71
-    const ENROLLMENT_STATUS_IDLE = 1;        // Nothing happens
71
+    const ENROLLMENT_STATUS_IDLE = 1; // Nothing happens
72 72
     const ENROLLMENT_STATUS_INITIALIZED = 2; // An enrollment session has begun
73
-    const ENROLLMENT_STATUS_RETRIEVED = 3;   // The device has retrieved the metadata
74
-    const ENROLLMENT_STATUS_PROCESSED = 4;   // The device has snet back a secret
75
-    const ENROLLMENT_STATUS_FINALIZED = 5;   // The application has stored the secret
76
-    const ENROLLMENT_STATUS_VALIDATED = 6;   // A first succesful authentication was performed
73
+    const ENROLLMENT_STATUS_RETRIEVED = 3; // The device has retrieved the metadata
74
+    const ENROLLMENT_STATUS_PROCESSED = 4; // The device has snet back a secret
75
+    const ENROLLMENT_STATUS_FINALIZED = 5; // The application has stored the secret
76
+    const ENROLLMENT_STATUS_VALIDATED = 6; // A first succesful authentication was performed
77 77
 
78 78
     const PREFIX_ENROLLMENT_SECRET = 'enrollsecret';
79 79
     const PREFIX_ENROLLMENT = 'enroll';
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
      * @param array $options
157 157
      * @param int $version The protocol version to use (defaults to the latest)
158 158
      */
159
-    public function __construct($options=array(), $version = 2)
159
+    public function __construct($options = array(), $version = 2)
160 160
     {
161 161
         $this->_options = $options;
162 162
         
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 
295 295
             $message = new $class($this->_options);
296 296
             $message->setId(time());
297
-            $message->setText("Please authenticate for " . $this->_name);
297
+            $message->setText("Please authenticate for ".$this->_name);
298 298
             $message->setAddress($notificationAddress);
299 299
             $message->setCustomProperty('challenge', $this->_getChallengeUrl($sessionKey));
300 300
             $message->send();
@@ -362,13 +362,13 @@  discard block
 block discarded – undo
362 362
      * @param String $spIdentifier If SP and IDP are 2 different things, pass the url/identifier of the SP the user is logging into.
363 363
      *                             For setups where IDP==SP, just leave this blank.
364 364
      */
365
-    public function startAuthenticationSession($userId="", $sessionId="", $spIdentifier="")
365
+    public function startAuthenticationSession($userId = "", $sessionId = "", $spIdentifier = "")
366 366
     {
367
-        if ($sessionId=="") {
367
+        if ($sessionId == "") {
368 368
             $sessionId = session_id();
369 369
         }
370 370
 
371
-        if ($spIdentifier=="") {
371
+        if ($spIdentifier == "") {
372 372
             $spIdentifier = $this->_identifier;
373 373
         }
374 374
 
@@ -378,11 +378,11 @@  discard block
 block discarded – undo
378 378
         
379 379
         $data = array("sessionId"=>$sessionId, "challenge"=>$challenge, "spIdentifier" => $spIdentifier);
380 380
         
381
-        if ($userId!="") {
381
+        if ($userId != "") {
382 382
             $data["userId"] = $userId;
383 383
         }
384 384
         
385
-        $this->_stateStorage->setValue(self::PREFIX_CHALLENGE . $sessionKey, $data, self::CHALLENGE_EXPIRE);
385
+        $this->_stateStorage->setValue(self::PREFIX_CHALLENGE.$sessionKey, $data, self::CHALLENGE_EXPIRE);
386 386
        
387 387
         return $sessionKey;
388 388
     }
@@ -402,9 +402,9 @@  discard block
 block discarded – undo
402 402
      *                           to php session)
403 403
      * @return String The enrollment key
404 404
      */
405
-    public function startEnrollmentSession($userId, $displayName, $sessionId="")
405
+    public function startEnrollmentSession($userId, $displayName, $sessionId = "")
406 406
     {
407
-        if ($sessionId=="") {
407
+        if ($sessionId == "") {
408 408
             $sessionId = session_id();
409 409
         }
410 410
         $enrollmentKey = $this->_uniqueSessionKey(self::PREFIX_ENROLLMENT);
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
             "displayName" => $displayName,
414 414
             "sessionId" => $sessionId
415 415
         ];
416
-        $this->_stateStorage->setValue(self::PREFIX_ENROLLMENT . $enrollmentKey, $data, self::ENROLLMENT_EXPIRE);
416
+        $this->_stateStorage->setValue(self::PREFIX_ENROLLMENT.$enrollmentKey, $data, self::ENROLLMENT_EXPIRE);
417 417
         $this->_setEnrollmentStatus($sessionId, self::ENROLLMENT_STATUS_INITIALIZED);
418 418
 
419 419
         return $enrollmentKey;
@@ -424,9 +424,9 @@  discard block
 block discarded – undo
424 424
      * @param $sessionId The application's session identifier (defaults
425 425
      *                   to php session)
426 426
      */
427
-    public function resetEnrollmentSession($sessionId="")
427
+    public function resetEnrollmentSession($sessionId = "")
428 428
     {
429
-        if ($sessionId=="") {
429
+        if ($sessionId == "") {
430 430
             $sessionId = session_id();
431 431
         }
432 432
 
@@ -471,9 +471,9 @@  discard block
 block discarded – undo
471 471
      *               A first successful authentication was performed 
472 472
      *               (todo: currently not used)
473 473
      */
474
-    public function getEnrollmentStatus($sessionId="")
474
+    public function getEnrollmentStatus($sessionId = "")
475 475
     { 
476
-        if ($sessionId=="") {
476
+        if ($sessionId == "") {
477 477
             $sessionId = session_id(); 
478 478
         }
479 479
         $status = $this->_stateStorage->getValue("enrollstatus".$sessionId);
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
      */
533 533
     public function getEnrollmentMetadata($enrollmentKey, $authenticationUrl, $enrollmentUrl)
534 534
     {
535
-        $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
535
+        $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT.$enrollmentKey);
536 536
         if (!is_array($data)) {
537 537
             return false;
538 538
         }
@@ -550,7 +550,7 @@  discard block
 block discarded – undo
550 550
                                array("identifier" =>$data["userId"],
551 551
                                      "displayName"=>$data["displayName"]));
552 552
 
553
-        $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
553
+        $this->_stateStorage->unsetValue(self::PREFIX_ENROLLMENT.$enrollmentKey);
554 554
 
555 555
         $this->_setEnrollmentStatus($data["sessionId"], self::ENROLLMENT_STATUS_RETRIEVED);
556 556
         return $metadata;
@@ -571,14 +571,14 @@  discard block
 block discarded – undo
571 571
      */
572 572
     public function getEnrollmentSecret($enrollmentKey)
573 573
     {
574
-         $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT . $enrollmentKey);
574
+         $data = $this->_stateStorage->getValue(self::PREFIX_ENROLLMENT.$enrollmentKey);
575 575
          $secret = $this->_uniqueSessionKey(self::PREFIX_ENROLLMENT_SECRET);
576 576
          $enrollmentData = [
577 577
              "userId" => $data["userId"],
578 578
              "sessionId" => $data["sessionId"]
579 579
          ];
580 580
          $this->_stateStorage->setValue(
581
-             self::PREFIX_ENROLLMENT_SECRET . $secret,
581
+             self::PREFIX_ENROLLMENT_SECRET.$secret,
582 582
              $enrollmentData,
583 583
              self::ENROLLMENT_EXPIRE
584 584
          );
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
      */
653 653
     public function authenticate($userId, $userSecret, $sessionKey, $response)
654 654
     {
655
-        $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE . $sessionKey);
655
+        $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE.$sessionKey);
656 656
         if (is_null($state)) {
657 657
             return self::AUTH_RESULT_INVALID_CHALLENGE;
658 658
         }
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
           $challengeUserId = $state["userId"];
666 666
         }
667 667
         // Check if we're dealing with a second factor
668
-        if ($challengeUserId!=NULL && ($userId != $challengeUserId)) {
668
+        if ($challengeUserId != NULL && ($userId != $challengeUserId)) {
669 669
             return self::AUTH_RESULT_INVALID_USERID; // only allowed to authenticate against the user that's authenticated in the first factor
670 670
         }
671 671
 
@@ -680,7 +680,7 @@  discard block
 block discarded – undo
680 680
             $this->_stateStorage->setValue("authenticated_".$sessionId, $userId, self::LOGIN_EXPIRE);
681 681
             
682 682
             // Clean up the challenge.
683
-            $this->_stateStorage->unsetValue(self::PREFIX_CHALLENGE . $sessionKey);
683
+            $this->_stateStorage->unsetValue(self::PREFIX_CHALLENGE.$sessionKey);
684 684
             
685 685
             return self::AUTH_RESULT_AUTHENTICATED;
686 686
         }
@@ -692,9 +692,9 @@  discard block
 block discarded – undo
692 692
      * @param String $sessionId The application's session identifier (defaults
693 693
      *                          to the php session).
694 694
      */
695
-    public function logout($sessionId="")
695
+    public function logout($sessionId = "")
696 696
     {
697
-        if ($sessionId=="") {
697
+        if ($sessionId == "") {
698 698
             $sessionId = session_id(); 
699 699
         }
700 700
         
@@ -729,9 +729,9 @@  discard block
 block discarded – undo
729 729
      * @return mixed An array with user data if a user was logged in or NULL if
730 730
      *               no user is logged in.
731 731
      */
732
-    public function getAuthenticatedUser($sessionId="")
732
+    public function getAuthenticatedUser($sessionId = "")
733 733
     {
734
-        if ($sessionId=="") {
734
+        if ($sessionId == "") {
735 735
             $sessionId = session_id(); 
736 736
         }
737 737
         
@@ -749,12 +749,12 @@  discard block
 block discarded – undo
749 749
      */
750 750
     protected function _getChallengeUrl($sessionKey)
751 751
     {                
752
-        $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE . $sessionKey);
752
+        $state = $this->_stateStorage->getValue(self::PREFIX_CHALLENGE.$sessionKey);
753 753
         if (is_null($state)) {
754 754
             return false;
755 755
         }
756 756
         
757
-        $userId   = NULL;
757
+        $userId = NULL;
758 758
         $challenge = $state["challenge"];
759 759
         if (isset($state["userId"])) {
760 760
             $userId = $state["userId"];
@@ -762,7 +762,7 @@  discard block
 block discarded – undo
762 762
         $spIdentifier = $state["spIdentifier"];
763 763
         
764 764
         // Last bit is the spIdentifier
765
-        return $this->_protocolAuth."://".(!is_null($userId)?urlencode($userId).'@':'').$this->getIdentifier()."/".$sessionKey."/".$challenge."/".urlencode($spIdentifier)."/".$this->_protocolVersion;
765
+        return $this->_protocolAuth."://".(!is_null($userId) ?urlencode($userId).'@' : '').$this->getIdentifier()."/".$sessionKey."/".$challenge."/".urlencode($spIdentifier)."/".$this->_protocolVersion;
766 766
     }
767 767
 
768 768
     /**
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
     protected function _uniqueSessionKey($prefix)
787 787
     {      
788 788
         $value = 1;
789
-        while ($value!=NULL) {
789
+        while ($value != NULL) {
790 790
             $sessionKey = $this->_ocraWrapper->generateSessionKey();
791 791
             $value = $this->_stateStorage->getValue($prefix.$sessionKey);
792 792
         }
Please login to merge, or discard this patch.
library/tiqr/Tiqr/AutoLoader.php 1 patch
Spacing   +9 added lines, -9 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,11 +32,11 @@  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
 		} else {
41 41
 			return;
42 42
 		}
@@ -57,34 +57,34 @@  discard block
 block discarded – undo
57 57
 		if (is_dir($tiqr_path)) {
58 58
 			$this->tiqrPath = $tiqr_path;
59 59
 		} else {
60
-			throw new Exception('Directory not found: ' . var_export($tiqr_dir, TRUE));
60
+			throw new Exception('Directory not found: '.var_export($tiqr_dir, TRUE));
61 61
 		}
62 62
 
63 63
 		if (isset($options["phpqrcode.path"])) {
64 64
 			$qrcode_dir = $options["phpqrcode.path"];
65 65
 			$qrcode_path = realpath($qrcode_dir);
66 66
 		} else {
67
-			$qrcode_dir = dirname(dirname(dirname(__FILE__))) . '/phpqrcode';
67
+			$qrcode_dir = dirname(dirname(dirname(__FILE__))).'/phpqrcode';
68 68
 			$qrcode_path = $qrcode_dir;
69 69
 		}
70 70
 
71 71
 		if (is_dir($qrcode_path)) {
72 72
 			$this->qrcodePath = $qrcode_path;
73 73
 		} else {
74
-			throw new Exception('Directory not found: ' . var_export($qrcode_dir, TRUE));
74
+			throw new Exception('Directory not found: '.var_export($qrcode_dir, TRUE));
75 75
 		}
76 76
 
77 77
 		if (isset($options["zend.path"])) {
78 78
 			$zend_dir = $options["zend.path"];
79 79
 			$zend_path = realpath($zend_dir);
80 80
 		} else {
81
-			$zend_dir = dirname(dirname(dirname(__FILE__))) . "/zend";
81
+			$zend_dir = dirname(dirname(dirname(__FILE__)))."/zend";
82 82
 			$zend_path = $zend_dir;
83 83
 		}
84 84
 		if (is_dir($zend_path)) {
85 85
 			$this->zendPath = $zend_path;
86 86
 		} else {
87
-			throw new Exception('Directory not found: ' . var_export($zend_dir, TRUE));
87
+			throw new Exception('Directory not found: '.var_export($zend_dir, TRUE));
88 88
 		}
89 89
 	}
90 90
 
Please login to merge, or discard this patch.