Skip to content

Commit 3081177

Browse files
committed
Replace strictTrueOnly flag with a dedicated setPathFromConnectionStrictBool method
1 parent 92fe6ff commit 3081177

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

‎src/OpenConext/EngineBlock/Metadata/Entity/Assembler/PushMetadataAssembler.php‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,9 @@ private function assembleSp(stdClass $connection)
222222
$properties += $this->setPathFromObjectBool([$connection, 'metadata:coin:transparant_issuer'], 'isTransparentIssuer');
223223
$properties += $this->setPathFromObjectBool([$connection, 'metadata:coin:trusted_proxy'], 'isTrustedProxy');
224224
$properties += $this->setPathFromObjectBool([$connection, 'metadata:coin:display_unconnected_idps_wayf'], 'displayUnconnectedIdpsWayf');
225-
$properties += $this->setPathFromObjectBool(
225+
$properties += $this->setPathFromConnectionStrictBool(
226226
[$connection, 'metadata:coin:' . self::COIN_WAYF_REMEMBER_CHOICE],
227-
'wayfRememberChoice',
228-
strictTrueOnly: true
227+
'wayfRememberChoice'
229228
);
230229

231230
$properties += $this->assembleIsConsentRequired($connection);
@@ -457,18 +456,24 @@ private function setPathFromObjectArray(array $from, string $to): array
457456
return array($to => $reference);
458457
}
459458

460-
private function setPathFromObjectBool(array $from, string $to, bool $strictTrueOnly = false): array
459+
private function setPathFromObjectBool(array $from, string $to): array
461460
{
462461
$reference = $this->getValueFromPath($from);
463462
if (is_null($reference)) {
464463
return array($to => null);
465464
}
466-
if ($strictTrueOnly) {
467-
return array($to => $reference === true || $reference === '1');
468-
}
469465
return array($to => (bool)$reference);
470466
}
471467

468+
private function setPathFromConnectionStrictBool(array $from, string $to): array
469+
{
470+
$reference = $this->getValueFromPath($from);
471+
if (is_null($reference)) {
472+
return array($to => null);
473+
}
474+
return array($to => $reference === true || $reference === '1');
475+
}
476+
472477
private function getValueFromPath(array $from)
473478
{
474479
$pathParts = explode(':', $from[1]);

0 commit comments

Comments
 (0)