Passed
Push — master ( dc6b36...4f566e )
by Tim
02:15
created
lib/Auth/Process/Consent.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
         if (array_key_exists('includeValues', $config)) {
98 98
             if (!is_bool($config['includeValues'])) {
99 99
                 throw new Error\Exception(
100
-                    'Consent: includeValues must be boolean. ' .
101
-                    var_export($config['includeValues'], true) . ' given.'
100
+                    'Consent: includeValues must be boolean. '.
101
+                    var_export($config['includeValues'], true).' given.'
102 102
                 );
103 103
             }
104 104
             $this->includeValues = $config['includeValues'];
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
         if (array_key_exists('checked', $config)) {
108 108
             if (!is_bool($config['checked'])) {
109 109
                 throw new Error\Exception(
110
-                    'Consent: checked must be boolean. ' .
111
-                    var_export($config['checked'], true) . ' given.'
110
+                    'Consent: checked must be boolean. '.
111
+                    var_export($config['checked'], true).' given.'
112 112
                 );
113 113
             }
114 114
             $this->checked = $config['checked'];
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
         if (array_key_exists('focus', $config)) {
118 118
             if (!in_array($config['focus'], ['yes', 'no'], true)) {
119 119
                 throw new Error\Exception(
120
-                    'Consent: focus must be a string with values `yes` or `no`. ' .
121
-                    var_export($config['focus'], true) . ' given.'
120
+                    'Consent: focus must be a string with values `yes` or `no`. '.
121
+                    var_export($config['focus'], true).' given.'
122 122
                 );
123 123
             }
124 124
             $this->focus = $config['focus'];
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
         if (array_key_exists('hiddenAttributes', $config)) {
128 128
             if (!is_array($config['hiddenAttributes'])) {
129 129
                 throw new Error\Exception(
130
-                    'Consent: hiddenAttributes must be an array. ' .
131
-                    var_export($config['hiddenAttributes'], true) . ' given.'
130
+                    'Consent: hiddenAttributes must be an array. '.
131
+                    var_export($config['hiddenAttributes'], true).' given.'
132 132
                 );
133 133
             }
134 134
             $this->hiddenAttributes = $config['hiddenAttributes'];
@@ -137,8 +137,8 @@  discard block
 block discarded – undo
137 137
         if (array_key_exists('attributes.exclude', $config)) {
138 138
             if (!is_array($config['attributes.exclude'])) {
139 139
                 throw new Error\Exception(
140
-                    'Consent: attributes.exclude must be an array. ' .
141
-                    var_export($config['attributes.exclude'], true) . ' given.'
140
+                    'Consent: attributes.exclude must be an array. '.
141
+                    var_export($config['attributes.exclude'], true).' given.'
142 142
                 );
143 143
             }
144 144
             $this->noconsentattributes = $config['attributes.exclude'];
@@ -146,8 +146,8 @@  discard block
 block discarded – undo
146 146
             Logger::warning("The 'noconsentattributes' option has been deprecated in favour of 'attributes.exclude'.");
147 147
             if (!is_array($config['noconsentattributes'])) {
148 148
                 throw new Error\Exception(
149
-                    'Consent: noconsentattributes must be an array. ' .
150
-                    var_export($config['noconsentattributes'], true) . ' given.'
149
+                    'Consent: noconsentattributes must be an array. '.
150
+                    var_export($config['noconsentattributes'], true).' given.'
151 151
                 );
152 152
             }
153 153
             $this->noconsentattributes = $config['noconsentattributes'];
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
                 $this->store = \SimpleSAML\Module\consent\Store::parseStoreConfig($config['store']);
159 159
             } catch (Exception $e) {
160 160
                 Logger::error(
161
-                    'Consent: Could not create consent storage: ' .
161
+                    'Consent: Could not create consent storage: '.
162 162
                     $e->getMessage()
163 163
                 );
164 164
             }
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
             isset($state['Source']['consent.disable']) &&
279 279
             self::checkDisable($state['Source']['consent.disable'], $spEntityId)
280 280
         ) {
281
-            Logger::debug('Consent: Consent disabled for entity ' . $spEntityId . ' with IdP ' . $idpEntityId);
281
+            Logger::debug('Consent: Consent disabled for entity '.$spEntityId.' with IdP '.$idpEntityId);
282 282
             Stats::log('consent:disabled', $statsData);
283 283
             return;
284 284
         }
@@ -286,14 +286,14 @@  discard block
 block discarded – undo
286 286
             isset($state['Destination']['consent.disable']) &&
287 287
             self::checkDisable($state['Destination']['consent.disable'], $idpEntityId)
288 288
         ) {
289
-            Logger::debug('Consent: Consent disabled for entity ' . $spEntityId . ' with IdP ' . $idpEntityId);
289
+            Logger::debug('Consent: Consent disabled for entity '.$spEntityId.' with IdP '.$idpEntityId);
290 290
             Stats::log('consent:disabled', $statsData);
291 291
             return;
292 292
         }
293 293
 
294 294
         if ($this->store !== null) {
295
-            $source = $state['Source']['metadata-set'] . '|' . $idpEntityId;
296
-            $destination = $state['Destination']['metadata-set'] . '|' . $spEntityId;
295
+            $source = $state['Source']['metadata-set'].'|'.$idpEntityId;
296
+            $destination = $state['Destination']['metadata-set'].'|'.$spEntityId;
297 297
             $attributes = $state['Attributes'];
298 298
             Assert::keyExists($attributes, $this->identifyingAttribute, "No attribute '%s' was found in the user's attributes.");
299 299
             $userId = $attributes[$this->identifyingAttribute];
@@ -305,16 +305,16 @@  discard block
 block discarded – undo
305 305
                 }
306 306
             }
307 307
 
308
-            Logger::debug('Consent: userid: ' . $userId);
309
-            Logger::debug('Consent: source: ' . $source);
310
-            Logger::debug('Consent: destination: ' . $destination);
308
+            Logger::debug('Consent: userid: '.$userId);
309
+            Logger::debug('Consent: source: '.$source);
310
+            Logger::debug('Consent: destination: '.$destination);
311 311
 
312 312
             $hashedUserId = self::getHashedUserID($userId, $source);
313 313
             $targetedId = self::getTargetedID($userId, $source, $destination);
314 314
             $attributeSet = self::getAttributeHash($attributes, $this->includeValues);
315 315
 
316 316
             Logger::debug(
317
-                'Consent: hasConsent() [' . $hashedUserId . '|' . $targetedId . '|' . $attributeSet . ']'
317
+                'Consent: hasConsent() ['.$hashedUserId.'|'.$targetedId.'|'.$attributeSet.']'
318 318
             );
319 319
 
320 320
             try {
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
                 $state['consent:store.destination'] = $targetedId;
334 334
                 $state['consent:store.attributeSet'] = $attributeSet;
335 335
             } catch (\Exception $e) {
336
-                Logger::error('Consent: Error reading from storage: ' . $e->getMessage());
336
+                Logger::error('Consent: Error reading from storage: '.$e->getMessage());
337 337
                 Logger::stats('Consent failed');
338 338
                 Stats::log('consent:failed', $statsData);
339 339
             }
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
      */
375 375
     public static function getHashedUserID(string $userid, string $source): string
376 376
     {
377
-        return hash('sha1', $userid . '|' . Utils\Config::getSecretSalt() . '|' . $source);
377
+        return hash('sha1', $userid.'|'.Utils\Config::getSecretSalt().'|'.$source);
378 378
     }
379 379
 
380 380
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
      */
390 390
     public static function getTargetedID(string $userid, string $source, string $destination): string
391 391
     {
392
-        return hash('sha1', $userid . '|' . Utils\Config::getSecretSalt() . '|' . $source . '|' . $destination);
392
+        return hash('sha1', $userid.'|'.Utils\Config::getSecretSalt().'|'.$source.'|'.$destination);
393 393
     }
394 394
 
395 395
 
Please login to merge, or discard this patch.