Skip to content

Commit ab0c547

Browse files
committed
Add trailing comma's
1 parent 5b6f1f2 commit ab0c547

File tree

6 files changed

+36
-36
lines changed

6 files changed

+36
-36
lines changed

src/Auth/Process/Consent.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public function __construct(array $config, $reserved)
101101
if (!is_bool($config['includeValues'])) {
102102
throw new Error\Exception(
103103
'Consent: includeValues must be boolean. ' .
104-
var_export($config['includeValues'], true) . ' given.'
104+
var_export($config['includeValues'], true) . ' given.',
105105
);
106106
}
107107
$this->includeValues = $config['includeValues'];
@@ -111,7 +111,7 @@ public function __construct(array $config, $reserved)
111111
if (!is_bool($config['checked'])) {
112112
throw new Error\Exception(
113113
'Consent: checked must be boolean. ' .
114-
var_export($config['checked'], true) . ' given.'
114+
var_export($config['checked'], true) . ' given.',
115115
);
116116
}
117117
$this->checked = $config['checked'];
@@ -121,7 +121,7 @@ public function __construct(array $config, $reserved)
121121
if (!in_array($config['focus'], ['yes', 'no'], true)) {
122122
throw new Error\Exception(
123123
'Consent: focus must be a string with values `yes` or `no`. ' .
124-
var_export($config['focus'], true) . ' given.'
124+
var_export($config['focus'], true) . ' given.',
125125
);
126126
}
127127
$this->focus = $config['focus'];
@@ -131,7 +131,7 @@ public function __construct(array $config, $reserved)
131131
if (!is_array($config['hiddenAttributes'])) {
132132
throw new Error\Exception(
133133
'Consent: hiddenAttributes must be an array. ' .
134-
var_export($config['hiddenAttributes'], true) . ' given.'
134+
var_export($config['hiddenAttributes'], true) . ' given.',
135135
);
136136
}
137137
$this->hiddenAttributes = $config['hiddenAttributes'];
@@ -141,7 +141,7 @@ public function __construct(array $config, $reserved)
141141
if (!is_array($config['attributes.exclude'])) {
142142
throw new Error\Exception(
143143
'Consent: attributes.exclude must be an array. ' .
144-
var_export($config['attributes.exclude'], true) . ' given.'
144+
var_export($config['attributes.exclude'], true) . ' given.',
145145
);
146146
}
147147
$this->noconsentattributes = $config['attributes.exclude'];
@@ -153,7 +153,7 @@ public function __construct(array $config, $reserved)
153153
} catch (Exception $e) {
154154
Logger::error(
155155
'Consent: Could not create consent storage: ' .
156-
$e->getMessage()
156+
$e->getMessage(),
157157
);
158158
}
159159
}
@@ -168,11 +168,11 @@ public function __construct(array $config, $reserved)
168168
Assert::keyExists(
169169
$config,
170170
'identifyingAttribute',
171-
"Consent: Missing mandatory 'identifyingAttribute' config setting."
171+
"Consent: Missing mandatory 'identifyingAttribute' config setting.",
172172
);
173173
Assert::stringNotEmpty(
174174
$config['identifyingAttribute'],
175-
"Consent: 'identifyingAttribute' must be a non-empty string."
175+
"Consent: 'identifyingAttribute' must be a non-empty string.",
176176
);
177177
$this->identifyingAttribute = $config['identifyingAttribute'];
178178
}
@@ -296,7 +296,7 @@ public function process(array &$state): void
296296
Assert::keyExists(
297297
$attributes,
298298
$this->identifyingAttribute,
299-
"Consent: Missing '" . $this->identifyingAttribute . "' in user's attributes."
299+
"Consent: Missing '" . $this->identifyingAttribute . "' in user's attributes.",
300300
);
301301

302302
$source = $state['Source']['metadata-set'] . '|' . $idpEntityId;
@@ -305,7 +305,7 @@ public function process(array &$state): void
305305
Assert::keyExists(
306306
$attributes,
307307
$this->identifyingAttribute,
308-
sprintf("Consent: No attribute '%s' was found in the user's attributes.", $this->identifyingAttribute)
308+
sprintf("Consent: No attribute '%s' was found in the user's attributes.", $this->identifyingAttribute),
309309
);
310310

311311
$userId = $attributes[$this->identifyingAttribute][0];
@@ -327,7 +327,7 @@ public function process(array &$state): void
327327
$attributeSet = self::getAttributeHash($attributes, $this->includeValues);
328328

329329
Logger::debug(
330-
'Consent: hasConsent() [' . $hashedUserId . '|' . $targetedId . '|' . $attributeSet . ']'
330+
'Consent: hasConsent() [' . $hashedUserId . '|' . $targetedId . '|' . $attributeSet . ']',
331331
);
332332

333333
try {
@@ -366,7 +366,7 @@ public function process(array &$state): void
366366
Stats::log('consent:nopassive', $statsData);
367367
throw new Module\saml\Error\NoPassive(
368368
Constants::STATUS_REQUESTER,
369-
'Unable to give consent on passive request.'
369+
'Unable to give consent on passive request.',
370370
);
371371
}
372372

src/Consent/Store/Cookie.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,14 @@ public function hasConsent(string $userId, string $destinationId, string $attrib
131131

132132
if (!array_key_exists($cookieName, $_COOKIE)) {
133133
Logger::debug(
134-
'Consent cookie - no cookie with name \'' . $cookieName . '\'.'
134+
'Consent cookie - no cookie with name \'' . $cookieName . '\'.',
135135
);
136136
return false;
137137
}
138138
if (!is_string($_COOKIE[$cookieName])) {
139139
Logger::warning(
140140
'Value of consent cookie wasn\'t a string. Was: ' .
141-
var_export($_COOKIE[$cookieName], true)
141+
var_export($_COOKIE[$cookieName], true),
142142
);
143143
return false;
144144
}
@@ -147,13 +147,13 @@ public function hasConsent(string $userId, string $destinationId, string $attrib
147147

148148
if ($_COOKIE[$cookieName] !== $data) {
149149
Logger::info(
150-
'Attribute set changed from the last time consent was given.'
150+
'Attribute set changed from the last time consent was given.',
151151
);
152152
return false;
153153
}
154154

155155
Logger::debug(
156-
'Consent cookie - found cookie with correct name and value.'
156+
'Consent cookie - found cookie with correct name and value.',
157157
);
158158

159159
return true;
@@ -212,7 +212,7 @@ public function deleteConsent(string $userId, string $destinationId): void
212212
public function deleteAllConsents(string $userId): void
213213
{
214214
throw new Exception(
215-
'The cookie consent handler does not support delete of all consents...'
215+
'The cookie consent handler does not support delete of all consents...',
216216
);
217217
}
218218

@@ -245,7 +245,7 @@ public function getConsents(string $userId): array
245245
$tmp = explode(':', $value, 3);
246246
if (count($tmp) !== 3) {
247247
Logger::warning(
248-
'Consent cookie with invalid value: ' . $value
248+
'Consent cookie with invalid value: ' . $value,
249249
);
250250
continue;
251251
}

src/Consent/Store/Database.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public function hasConsent(string $userId, string $destinationId, string $attrib
173173
'UPDATE ' . $this->table . ' ' .
174174
'SET usage_date = ' . $this->dateTime . ' ' .
175175
'WHERE hashed_user_id = ? AND service_id = ? AND attribute = ?',
176-
[$userId, $destinationId, $attributeSet]
176+
[$userId, $destinationId, $attributeSet],
177177
);
178178

179179
if ($st === false) {
@@ -210,7 +210,7 @@ public function saveConsent(string $userId, string $destinationId, string $attri
210210
'UPDATE ' . $this->table . ' ' .
211211
'SET consent_date = ' . $this->dateTime . ', usage_date = ' . $this->dateTime . ', attribute = ? ' .
212212
'WHERE hashed_user_id = ? AND service_id = ?',
213-
[$attributeSet, $userId, $destinationId]
213+
[$attributeSet, $userId, $destinationId],
214214
);
215215

216216
if ($st === false) {
@@ -227,7 +227,7 @@ public function saveConsent(string $userId, string $destinationId, string $attri
227227
$st = $this->execute(
228228
'INSERT INTO ' . $this->table . ' (' . 'consent_date, usage_date, hashed_user_id, service_id, attribute' .
229229
') ' . 'VALUES (' . $this->dateTime . ', ' . $this->dateTime . ', ?, ?, ?)',
230-
[$userId, $destinationId, $attributeSet]
230+
[$userId, $destinationId, $attributeSet],
231231
);
232232

233233
if ($st !== false) {
@@ -251,7 +251,7 @@ public function deleteConsent(string $userId, string $destinationId): int
251251
{
252252
$st = $this->execute(
253253
'DELETE FROM ' . $this->table . ' WHERE hashed_user_id = ? AND service_id = ?;',
254-
[$userId, $destinationId]
254+
[$userId, $destinationId],
255255
);
256256

257257
if ($st === false) {
@@ -279,7 +279,7 @@ public function deleteAllConsents(string $userId): int
279279
{
280280
$st = $this->execute(
281281
'DELETE FROM ' . $this->table . ' WHERE hashed_user_id = ?',
282-
[$userId]
282+
[$userId],
283283
);
284284

285285
if ($st === false) {
@@ -312,7 +312,7 @@ public function getConsents(string $userId): array
312312
$st = $this->execute(
313313
'SELECT service_id, attribute, consent_date, usage_date FROM ' . $this->table .
314314
' WHERE hashed_user_id = ?',
315-
[$userId]
315+
[$userId],
316316
);
317317

318318
if ($st === false) {
@@ -349,15 +349,15 @@ private function execute(string $statement, array $parameters)
349349
if ($st === false) {
350350
Logger::error(
351351
'consent:Database - Error preparing statement \'' .
352-
$statement . '\': ' . self::formatError($db->errorInfo())
352+
$statement . '\': ' . self::formatError($db->errorInfo()),
353353
);
354354
return false;
355355
}
356356

357357
if ($st->execute($parameters) !== true) {
358358
Logger::error(
359359
'consent:Database - Error executing statement \'' .
360-
$statement . '\': ' . self::formatError($st->errorInfo())
360+
$statement . '\': ' . self::formatError($st->errorInfo()),
361361
);
362362
return false;
363363
}
@@ -395,7 +395,7 @@ public function getStatistics(): array
395395
$st = $this->execute(
396396
'SELECT COUNT(*) AS no ' .
397397
'FROM (SELECT DISTINCT hashed_user_id FROM ' . $this->table . ' ) AS foo',
398-
[]
398+
[],
399399
);
400400

401401
if ($st === false) {
@@ -409,7 +409,7 @@ public function getStatistics(): array
409409
// Get total number of services that has been given consent to
410410
$st = $this->execute(
411411
'SELECT COUNT(*) AS no FROM (SELECT DISTINCT service_id FROM ' . $this->table . ') AS foo',
412-
[]
412+
[],
413413
);
414414

415415
if ($st === false) {
@@ -477,7 +477,7 @@ public function selftest(): bool
477477
{
478478
$st = $this->execute(
479479
'SELECT * FROM ' . $this->table . ' WHERE hashed_user_id = ? AND service_id = ? AND attribute = ?',
480-
['test', 'test', 'test']
480+
['test', 'test', 'test'],
481481
);
482482

483483
if ($st === false) {

src/Controller/ConsentController.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function getconsent(Request $request)
135135
$attributeSet = $state['consent:store.attributeSet'];
136136

137137
$this->logger::debug(
138-
'Consent - saveConsent() : [' . $userId . '|' . $targetedId . '|' . $attributeSet . ']'
138+
'Consent - saveConsent() : [' . $userId . '|' . $targetedId . '|' . $attributeSet . ']',
139139
);
140140
try {
141141
$store->saveConsent($userId, $targetedId, $attributeSet);
@@ -209,7 +209,7 @@ public function getconsent(Request $request)
209209
$privacypolicy = str_replace(
210210
'%SPENTITYID%',
211211
urlencode($spentityid),
212-
$privacypolicy
212+
$privacypolicy,
213213
);
214214
}
215215
$t->data['sppp'] = $privacypolicy;
@@ -252,12 +252,12 @@ public function noconsent(Request $request): Template
252252

253253
$resumeFrom = Module::getModuleURL(
254254
'consent/getconsent',
255-
['StateId' => $stateId]
255+
['StateId' => $stateId],
256256
);
257257

258258
$logoutLink = Module::getModuleURL(
259259
'consent/logout',
260-
['StateId' => $stateId]
260+
['StateId' => $stateId],
261261
);
262262

263263
$aboutService = null;

src/Store.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public static function parseStoreConfig($config): Store
142142
$className = Module::resolveClass(
143143
$config[0],
144144
'Consent\Store',
145-
'\SimpleSAML\Module\consent\Store'
145+
'\SimpleSAML\Module\consent\Store',
146146
);
147147

148148
unset($config[0]);

tests/src/Controller/ConsentControllerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static function setUpBeforeClass(): void
4949
'enable.saml20-idp' => true,
5050
],
5151
'[ARRAY]',
52-
'simplesaml'
52+
'simplesaml',
5353
);
5454

5555
self::$session = Session::getSessionFromRequest();
@@ -72,7 +72,7 @@ public function testGetconsentAccept(): void
7272
$request = Request::create(
7373
'/getconsent',
7474
'GET',
75-
['yes' => '', 'saveconsent' => '1', 'StateId' => 'someStateId']
75+
['yes' => '', 'saveconsent' => '1', 'StateId' => 'someStateId'],
7676
);
7777

7878
$c = new Controller\ConsentController(self::$config, self::$session);

0 commit comments

Comments
 (0)